
clear all 
set more off

// set matsize 10000

********* READ ME *********************************************************************

** Glossary
// pp = percentage point
// com = communication
// part1sophistication = financial competence in part 1 (no preferences involved)
// diffPart1soph = own - partner's part1sophistication
// financial competence is the absolute difference between complex and simple framing. Lower is better.

** Technical
// The command "if 0 {}" means the commands in brackets will not be executed. 
// The command "if 1 {}" means the commands in brackets will be executed. 

***************************************************************************************



********* Define variables, interactions etc.				***************************
if 1 { 
	quietly {

	use "data/mainDatawTranscription.dta"
	
	// data are always long

	//		switchNormal: 	normalized switch point
	//		deltaComplex: 	normalized switch point in complexly framed question, set to missing for simply framed questions
	//		deltaSimple: 	normalized switch point in simply framed question, set to missing for complexly framed questions


	gen comEduc 			= treatment == 1
	gen comMain 			= treatment == 0
	gen noComMain	  		= treatment == 3
	gen noComNoAnnounce 	= treatment == 2
	
	gen com = comEduc == 1 | comMain == 1
	gen noCom = noComMain == 1 | noComNoAnnounce == 1
	
	gen main = comMain == 1 | noComMain == 1

	capture: gen logHHinc = log(hhinc)
	capture: gen ageSq = age^2
	capture: gen logHHincPerCap = log(hhinc/hhsize)


	drop diffDelta
	rename DiffDelta diffDelta
	rename pairID pairId
	
	gen finLitSum = finLit1 + finLit2 + finLit3
	
	// binarize card ownership question
	
	replace cardown = 0 if cardown == 1
	replace cardown = 1 if cardown > 1
		
	// alternative knowledgeability measure
	
	
	
	replace absDiffDelta = abs(switchNormal - 1) if part == 1
	
	capture: drop absDiffDeltaND
	capture: drop absDiffDeltaD
	capture: gen absDiffDeltaND = absDiffDelta if discussed == 0 | part <= 2
	capture: gen absDiffDeltaD = absDiffDelta if discussed == 1
		
	capture: bysort part id: egen meanAbsDiffDeltaND = mean(absDiffDeltaND)
	capture: bysort part id: egen meanAbsDiffDeltaD = mean(absDiffDeltaD)
	
	gen absDiffPart2 = absDiffDelta if part == 2

	/*
	gen part1sophistication_i = meanAbsDiffDeltaND if part == 1
	bysort id: egen part1sophistication = max(part1sophistication_i)
	drop part1sophistication_i
	*/
	
	gen part1sophistication_i = abs(1 - switchNormal) if decisionNumber == 7 | decisionNumber == 8 | decisionNumber == 9 
	bysort id: egen part1sophistication = mean(part1sophistication_i)
	
	gen part2sophistication_i = absDiffPart2
	bysort id: egen part2sophistication = mean(part2sophistication_i)
	
	gen part2FVsophistication_i = abs(1 - switchNormal) if decisionNumber == 22 | decisionNumber == 23 | decisionNumber == 24
	bysort id: egen part2FVsophistication = mean(part2FVsophistication_i)
	
	gen preexistingSoph_i = .
	replace preexistingSoph_i = abs(1 - switchNormal) if decisionNumber == 7 | decisionNumber == 8 | decisionNumber == 9 | decisionNumber == 22 | decisionNumber == 23 | decisionNumber == 24

	order part1sophistication part1sophistication_i part2FVsophistication part2FVsophistication_i 
	sort id decisionNumber
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	gen part12sophistication = (part1sophistication + part2FVsophistication) / 2
	gen part122sophistication = (part1sophistication + part2FVsophistication + 2 * part2sophistication) / 2
	

	drop *_i
	
	
	// get timePrefs for all stages
	
	gen dSimple = switchNormal if timePrefs == 1
	
	// get time preferences of discussion partner
	
	sort id
	by id: egen meanDeltaS_i = mean(dSimple) if part == 2
	by id: egen meanDeltaS = mean(meanDeltaS_i)
	sort pairId id
	by pairId: egen deltaSmax = max(meanDeltaS)
	by pairId: egen deltaSmin = min(meanDeltaS)
	gen deltaSpartner = .
	replace deltaSpartner = deltaSmin if deltaSmax == meanDeltaS
	replace deltaSpartner = deltaSmax if deltaSmin == meanDeltaS
	drop meanDeltaS_i meanDeltaS deltaSmax deltaSmin

	sort id
	by id: egen meanDeltaS_i = mean(dSimple) if part == 3
	by id: egen meanDeltaS = mean(meanDeltaS_i)
	sort pairId id
	by pairId: egen deltaSmax = max(meanDeltaS)
	by pairId: egen deltaSmin = min(meanDeltaS)
	gen deltaSpartnerContemp = .
	replace deltaSpartnerContemp = deltaSmin if deltaSmax == meanDeltaS
	replace deltaSpartnerContemp = deltaSmax if deltaSmin == meanDeltaS
	drop meanDeltaS_i meanDeltaS deltaSmax deltaSmin
	
	sort id
	by id: egen meanDeltaS_i = mean(dSimple) if part == 1
	by id: egen meanDeltaS = mean(meanDeltaS_i)
	sort pairId id
	by pairId: egen deltaSmax = max(meanDeltaS)
	by pairId: egen deltaSmin = min(meanDeltaS)
	gen deltaSpartnerPart1 = .
	replace deltaSpartnerPart1 = deltaSmin if deltaSmax == meanDeltaS
	replace deltaSpartnerPart1 = deltaSmax if deltaSmin == meanDeltaS
	drop meanDeltaS_i meanDeltaS deltaSmax deltaSmin
		

	bysort id: egen ownTimePrefsMean3_i = mean(switchNormal) if part == 3 & timePrefs == 1
	by id: egen ownTimePrefsMean3 = max(ownTimePrefsMean3_i)			
		
	
	gen mplCheck = understandingCheck1 == 1 & understandingCheck2 == 1
	
	
	// replace missing data by numbers to include as dummies
 	
	replace gpa = 10 if gpa == .
	replace international = 2 if internat == .
	replace major = 9 if major == .
	
	gen finassistance = .
	foreach i in 1 3 4 6 7 8 {
		replace finassistance = `i' if finassista_`i' == 1
	}
	replace finassistance = 9 if finassistance == .
	
	rename cashadvanc cashadvance
	replace cashadvance = 3 if cashadvance == .	// 3 is "not applicable"
	replace cardroll = 7 if cardroll == .		// 7 is "not applicable"
	replace heardBefore = 3 if heardBef == .
	replace talk = 3 if talk == .
	replace prepared = 3 if prepared == .	
	replace followup = 3 if followup == .
	
	// code big5 measures
	
	gen bigFive_consc = big5_3 - big5_23
	gen bigFive_agree = big5_22 - big5_32
	gen bigFive_neuro = big5_39 - big5_9
	gen bigFive_open = big5_20 - big5_41
	gen bigFive_extra = big5_36 - big5_6 

	// discussion data
	
	rename disctime_3 discussionTime
	drop disctime*
	replace discussionTime = workoutStartTime if treatment == 3
	
	rename discussed_1  discussionInfluencedDecisions
	rename dischelped_1 discussionHelpedSelfReport			
	
	// debriefing data
	
	replace talk = 0 	 	if talk == 2
	replace prepared = 0 	if prepared == 2
	replace followup = 0 	if followup == 2



	// make part1soph and part2soph into rank-variables
	
	foreach i in 1 2 12 122 {

		sort id part`i'sophistication
		egen part`i'sophRmain_i 	= rank(part`i'sophistication) if tagId == 1 					
		egen part`i'sophRreceiver_i = rank(part`i'sophistication) if tagId == 1 & receiver == 1 	
		egen part`i'sophRsender_i 	= rank(part`i'sophistication) if tagId == 1 & sender == 1		

		count if tagId == 1	 
		local n = r(N)
		replace part`i'sophRmain_i = part`i'sophRmain_i / `n'
		
		count if tagId == 1 & receiver == 1 	
		local n = r(N)
		replace part`i'sophRreceiver_i = part`i'sophRreceiver_i / `n'
		
		count if tagId == 1 & sender == 1 
		local n = r(N)
		replace part`i'sophRsender_i = part`i'sophRsender_i / `n'
		
		by id: egen part`i'sophRmain = max(part`i'sophRmain_i)
		
		gen part`i'sophR_i = .
		replace part`i'sophR_i = part`i'sophRreceiver_i if receiver == 1
		replace part`i'sophR_i = part`i'sophRsender_i if sender == 1
		by id: egen part`i'sophR = max(part`i'sophR_i)
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	}
	
	
	su part1sophisti , d
	gen part1sophM1 = part1sophisti < r(p50)
	gen part1sophM2 = part1sophisti >= r(p50)
	gen part1sophQ1 = 							part1sophisti < r(p25)
	gen part1sophQ2 = part1sophisti >= r(p25) & part1sophisti < r(p50)
	gen part1sophQ3 = part1sophisti >= r(p50) & part1sophisti < r(p75)
	gen part1sophQ4 = part1sophisti >= r(p75) 

	
	su part12sophisti , d
	gen part12sophM1 = part12sophisti < r(p50)
	gen part12sophM2 = part12sophisti >= r(p50)
	gen part12sophQ1 = 							part12sophisti < r(p25)
	gen part12sophQ2 = part12sophisti >= r(p25) & part12sophisti < r(p50)
	gen part12sophQ3 = part12sophisti >= r(p50) & part12sophisti < r(p75)
	gen part12sophQ4 = part12sophisti >= r(p75) 
	
	su part122sophisti , d
	gen part122sophM1 = part122sophisti < r(p50)
	gen part122sophM2 = part122sophisti >= r(p50)
	gen part122sophQ1 = 							part122sophisti < r(p25)
	gen part122sophQ2 = part122sophisti >= r(p25) & part122sophisti < r(p50)
	gen part122sophQ3 = part122sophisti >= r(p50) & part122sophisti < r(p75)
	gen part122sophQ4 = part122sophisti >= r(p75) 
		
	// interactions
	
	capture: gen com_part3 = com * part3
	capture: gen comMain_discussed = comMain * discussed
	capture: gen com_part1sophistication = com * part1sophistication
	capture: gen com_part1sophPartner = com * part1sophPartner
	capture: gen com_partnerGender = com * partnerGender
	
			
	capture: gen part1educ = part1 * comEduc
	capture: gen part2educ = part2 * comEduc
	capture: gen part3educ = part3 * comEduc
	
	
	// get partner characteristics

	sort id
	local varlist = " part2sophistication part2sophR part1sophR part12sophR part122sophR  finLitSum male ethni native international community cogAbility logHHincPerCap cardown cashad cardroll conformity bigFive_consc bigFive_agree bigFive_neuro bigFive_open bigFive_extra"
	
	foreach var in `varlist' {
		sort id
		by id: egen var_i = mean(`var')
		by id: egen var = mean(`var')
		sort pairId id
		by pairId: egen varmax = max(var)
		by pairId: egen varmin = min(var)
		gen `var'Partner = .
		replace `var'Partner = varmin if varmax == var
		replace `var'Partner = varmax if varmin == var
		drop var_i var varmin varmax
	}
	
			
	****** Check for and drop duplicate participants *****
	
	
	sort session		// by sorting by session, I make sure that the second time the student participates he is assigned tag 0, so I can drop all the second participations while keeping the first
	egen tagEmail = tag(email) if tagId == 1
	replace tagEmail = . if tagId == 0
	bysort id: egen tagEmailMin = min(tagEmail)


	
	keep if tagEmailMin == 1
	drop tagEmail*
	
	
	****** Match part 2 and part 3 decisions on question level (more power)	****
	
	
	gen simple = timePrefs
	
	gen locationMPL = .
	replace locationMPL = 1 if bottom == 1
	replace locationMPL = 2 if middle == 1
	replace locationMPL = 3 if top == 1
	
	sort decisionNumber
	egen stage23match = group(delay locationMPL) ///
		if (decisionNumber >= 25 & decisionNumber <= 30) ///
		|  (decisionNumber >= 10 & decisionNumber <= 15) ///
		|  (decisionNumber >= 31 & decisionNumber <= 36) ///

	replace stage23match = . if simple == 1	

	gen decisionKind = .
	replace decisionKind = 1 if part == 2
	replace decisionKind = 2 if part == 3 & discussed == 1
	replace decisionKind = 3 if part == 3 & discussed == 0
	
	sort id part stage23
	order id part stage23 decisionKind decisionNumber location delay bottom middle top
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	

	
	// in part 2, attach each pref question to the respective complexly framed one
	// in part 3, attach each pref question to the respective NON-DISCUSSED complexly framed one, and set it to missing for the discussed ones
	gen prefsMatch = .
	
	// stage 2
	replace prefsMatch = 1  if decisionNumber == 10 | decisionNumber == 16
	replace prefsMatch = 2  if decisionNumber == 11 | decisionNumber == 17
	replace prefsMatch = 3  if decisionNumber == 12 | decisionNumber == 18
	replace prefsMatch = 4  if decisionNumber == 13 | decisionNumber == 19
	replace prefsMatch = 5  if decisionNumber == 14 | decisionNumber == 20
	replace prefsMatch = 6  if decisionNumber == 15 | decisionNumber == 21
	
	// stage 3
	replace prefsMatch = 7  if decisionNumber == 31 | decisionNumber == 37
	replace prefsMatch = 8  if decisionNumber == 32 | decisionNumber == 38
	replace prefsMatch = 9  if decisionNumber == 33 | decisionNumber == 39
	replace prefsMatch = 10 if decisionNumber == 34 | decisionNumber == 40
	replace prefsMatch = 11 if decisionNumber == 35 | decisionNumber == 41
	replace prefsMatch = 12 if decisionNumber == 36 | decisionNumber == 42
	
	// generate question and part specific time preferences
	gen prefs_i = switchNormal if simple == 1	
	
	sort id prefsMatch
	by id prefsMatch: egen prefs = max(prefs_i)
	
	***** define individual noisiness in behavior
	
	sort id
	by id: egen sdSimple_i = sd(deltaSimple) if part == 2
	by id: egen sdSimple = mean(sdSimple_i) 	

	**** drop all auxiliary variables
		
	drop *_i	
	
	
	// add absolute difference with stage-0 preferences taken as welfare-relevant benchmark
	if 1{
	preserve
			
		capture drop absD1 absD2 absD3 absD4
		
		
		sort pairId decisionNumber
		by pairId decisionNumber: egen maxxSwitchNormal = max(switchNormal) if pairId!=.
		by pairId decisionNumber: egen minnSwitchNormal = min(switchNormal) if pairId!=.	
		gen partnerSwitchNormal=.
		replace partnerSwitchNormal=maxxSwitchNormal if switchNormal==minnSwitchNormal
		replace partnerSwitchNormal=minnSwitchNormal if switchNormal==maxxSwitchNormal
	
		
		keep if receiver == 1

		replace locationMPL = 1 if decisionN == 1 | decisionN == 4
		replace locationMPL = 2 if decisionN == 2 | decisionN == 5 
		replace locationMPL = 3 if decisionN == 3 | decisionN == 6 	
		
		sort id decisionN
		order id decisionN simple
		egen stage123match = group(delay locationMPL)
		order stage123match
		// notice: variable stage123match is NOT missing only for decisions in sets S0, C1, C2, D.
		
		
		replace discussed = 0 if discussed == .
		gen partDisc = part + discussed
		
		keep if FV == 0
		keep switchNormal partnerSwitchNormal id stage123match partDisc decisionN
		
		drop if stage123match == .
		reshape wide switchNormal partnerSwitchNormal decisionN, i(id stage123match) j(partDisc)
		
		forvalues i = 2 / 4 {
			gen absD`i' = abs(switchNormal`i' - switchNormal1)
			gen MabsD`i'=abs(partnerSwitchNormal`i'-switchNormal1)
		}
		
		rename stage123match stage23match
		
		drop switch* partnerSwitch*
		
		reshape long absD MabsD decisionNumber, i(stage23match id) j(stage)
		
		gen part = .
		replace part = 2 if stage == 2
		replace part = 3 if stage == 3 | stage == 4
		
		gen discussed = stage == 4
		drop stage part
		
		sort id disc  
		order stage23 id discussed    
		rename absD absD_0benchmark
		rename MabsD MabsD_0benchmark
		
		replace disc = . if decisionN > 15 & decisionN < 31
		
		save "data/stage0benchmark.dta", replace
		
	restore
	}
	capture drop _merge
	merge m:1 id decisionNumber using "data/stage0benchmark.dta"
	
	 
	saveold "data/mainDataCleaned.dta", replace
	
	
	// Test: How do results hold up if we only include those subject to EGB?
	
	sort id
	by id: egen egb_i = mean(diffDelta) if part < 3 & top == 1 | middle == 1 | bottom == 1
	by id: egen egb = mean(egb_i)
	
	keep if egb <= 0

	saveold "data/mainDataCleanedEBGsubjectsOnly.dta", replace
	
	
	} 
}
	
********* Define set of control variables					***************************
if 1 {	

	// set the following to 1 if the dependent variable should be the log of the percentage improvement.
	// set it to 0 if it should be the levels
	local analysisInLogs = 0
	
	local demoFirst = "male age ageSq i.ethnicity nativel"
	local demoSecond = "i.international  i.community"	// community is urban, suburban or rural
	local cog = "cogAbility mplCheck"	// variable knowledgeable is a coarsening of a continuous variable, and hence a suboptimal predictor
	local financials = "logHHincPerCap i.cardown i.finLit  i.cashadvance i.cardroll"
	local debrief = "i.heardBefore i.talk i.prepared i.followup"
	local psych = "conformity bigFive_consc bigFive_agree bigFive_neuro bigFive_open bigFive_extra" 

	local demo = "`demoFirst' `demoSecond'"
	local psychCog = "`cog' `psych' `debrief'"
	local survey = "`financials' "
	
	local controls = "`demoFirst' `demoSecond' `cog' `financials' `debrief' `psych'"
	local controlsNoGender = "age ageSq i.ethni native `demoSecond' `cog' `financials' `debrief' `psych'"
	
	// Controls
	// 1. Demographics
	// 2. Survey: Debrief vars and Financials
	// 3. psychCog: Psych and cog
	
}		
	
	
	
	
***************************************************************************************
*********	Numbers mentioned in Main Text					***************************
***************************************************************************************

********* Summary stats etc.								***************************
if 1 {	
	
	clear
	use "data/mainDataCleaned.dta"
	
	count if mplCheck == 1 & tagId == 1
	count if mplCheck == 0 & tagId == 1
	su mplCheck if tagId == 1
	
	count if mplCheck == 1 & tagId == 1	& receiver == 1
	count if mplCheck == 0 & tagId == 1	& receiver == 1
	su mplCheck if tagId == 1			& receiver == 1

	count if mplCheck == 1 & tagId == 1	& receiver == 0
	count if mplCheck == 0 & tagId == 1	& receiver == 0
	su mplCheck if tagId == 1			& receiver == 0
	
	keep if mplCheck == 1
	reg ownTimePrefsMean if tagId == 1
	su ownTimePrefsMean if tagId == 1
	
	tab delay if timePrefs == 1 & mplCheck == 1, su(switchNormal)
	tab delay if timePrefs == 1 & mplCheck == 1  & receiver == 1, su(switchNormal)

	tab delay if timePrefs == 1 & mplCheck == 1 & part == 1, su(switchNormal)
	tab delay if timePrefs == 1 & mplCheck == 1 & part == 2, su(switchNormal)
	tab delay if timePrefs == 1 & mplCheck == 1 & part == 3, su(switchNormal)
	
	tab delay if timePrefs == 1 & mplCheck == 1 & part == 1 & receiver == 1, su(switchNormal)
	tab delay if timePrefs == 1 & mplCheck == 1 & part == 2 & receiver == 1, su(switchNormal)
	tab delay if timePrefs == 1 & mplCheck == 1 & part == 3 & receiver == 1, su(switchNormal)

	su finLit*
	su finLit* if receiver == 1
	
}
	
********* Exponential growth bias							***************************
if 1 {

	clear
	use "data/mainDataCleaned.dta"

	keep if mplCheck == 1
	keep if receiver == 1
	
	// This included in main text:	
	reg diffDelta if part < 3, cl(id)

	// This in footnote (separated by MPL location):	
	reg diffDelta if part < 3 & top == 1	, cl(id)
	reg diffDelta if part < 3 & middle == 1	, cl(id)
	reg diffDelta if part < 3 & bottom == 1	, cl(id)

	capture: gen egbFV = 1 - switchNormal if decisionNumber == 7 | decisionNumber == 8 | decisionNumber == 9 | decisionNumber == 22 | decisionNumber == 23 | decisionNumber == 24
	
	replace bottom = 1 	if decisionNumber == 7 | decisionNumber == 24
	replace middle = 1 	if decisionNumber == 8 | decisionNumber == 22 
	replace top = 1 	if decisionNumber == 9 | decisionNumber == 23 
	
	bysort id: egen meanEgbFV = mean(egbFV)
	su meanEgbFV
	su egbFV
	reg egbFV if bottom == 1 , cl(id)	
	reg egbFV if middle == 1 , cl(id)	
	reg egbFV if top == 1 	 , cl(id)
	
		
}
		
********* Who has how much room left to improve? 			***************************
if 1 { 
	clear
	use "data/mainDataCleaned.dta"

	keep if receiver == 1
	keep if mplCheck == 1
	
	reg absDiffDelta if 				 	part == 2, cl(id)
	reg absDiffDelta if 				 	part == 2 & comMain == 1, cl(id)
	reg absDiffDelta if 				 	part == 2 & comEduc == 1, cl(id)
	reg absDiffDelta if 				 	part == 2 & noCom == 1, cl(id)
	reg absDiffDelta if 				 	part == 2 & comEduc == 0, cl(id)
	
	reg absDiffDelta if part12sophM1 == 1 & part == 2					, cl(id)
	reg absDiffDelta if part12sophM1 == 1 & part == 2 & comMain == 1	, cl(id)
	reg absDiffDelta if part12sophM1 == 1 & part == 2 & comEduc == 1	, cl(id)
	reg absDiffDelta if part12sophM1 == 1 & part == 2 & noCom == 1		, cl(id)
	reg absDiffDelta if part12sophM1 == 1 & part == 2 & comEduc == 0	, cl(id)
	
	reg absDiffDelta if part12sophM1 == 0 & part == 2					, cl(id)
	reg absDiffDelta if part12sophM1 == 0 & part == 2 & comMain == 1	, cl(id)
	reg absDiffDelta if part12sophM1 == 0 & part == 2 & comEduc == 1	, cl(id)
	reg absDiffDelta if part12sophM1 == 0 & part == 2 & noCom == 1		, cl(id)

	
	// How much loss due to noise in simple frame?
	
		// grouped by time
		preserve
			keep if part == 2 & timePre == 1
			
			replace decisionNumber = decisionNumber - 15
			gen time = decisionNumber <= 3
			keep switchNormal time comMain comEduc id decisionNumber part12sophM1
			reshape wide switchNormal comMain comEduc time, i(id) j(decisionNumber)
			
			local numDev = 0
			gen totalDev = 0
			forvalues i = 1 / 6 {
				forvalues j = `i' / 6 {
					if (`i' ~= `j') & (time`i' == time`j') {
						gen simpleDev`i'`j' = abs(switchNormal`i' - switchNormal`j')
						local numDev = `numDev' + 1
						replace totalDev = totalDev + simpleDev`i'`j'
					}
				}
			}
			di `numDev'
			replace totalDev = totalDev / `numDev'
			
			su totalDev
			su totalDev if part12sophM1 == 1
			su totalDev if part12sophM1 == 0
		restore
		
		// grouped by mplLocation
		preserve
			keep if part == 2 & timePre == 1
			
			replace decisionNumber = decisionNumber - 15
			gen mplLocation = mod(decisionNumber,3)
			keep switchNormal mplLocation comMain comEduc id decisionNumber part12sophM1
			reshape wide switchNormal comMain comEduc mplLocation, i(id) j(decisionNumber)
			
			local numDev = 0
			gen totalDev = 0
			forvalues i = 1 / 6 {
				forvalues j = `i' / 6 {
					if (`i' ~= `j') & (mplLocation`i' == mplLocation`j') {
						gen simpleDev`i'`j' = abs(switchNormal`i' - switchNormal`j')
						local numDev = `numDev' + 1
						replace totalDev = totalDev + simpleDev`i'`j'
					}
				}
			}
			di `numDev'
			replace totalDev = totalDev / `numDev'
			
			su totalDev
			su totalDev if part12sophM1 == 1
			su totalDev if part12sophM1 == 0
		restore
	
	
}	
	
	
***************************************************************************************		
********* Main text tables		 		***********************************************
***************************************************************************************	


********* TABLE 5: Discussion content 						***************************
if 1 {

	// replace 99 with missing for all new variables
	foreach var in  talkAboutrule numberOfProbDiscussed numberOfProbDiscussedFV ///
	numberOfProbDiscussedPV numberOfProbAgreedFV numberOfProbAgreedPV SmallTalkMajor ///
	SmallTalkYear SmallTalkFromWhere smallTalkvsTask commSymmetric convinceKnowledgeable ///
	paymentMarketIntRate paymentAmazonGift paymenttrustExp paymentLikelihood Approach ///
	{
		replace `var' = . if `var' == 99
	}
	
	gen highlightSimilarities = .
	replace highlightSimilarities = 1 if Approach == 1 | Approach == 2
	replace highlightSimilarities = 0 if Approach == 3 | Approach == 4 | Approach == 0
	gen hSim = highlightSimilarities
	gen numProb = numberOfProbDiscussed
	gen tDisc = discussionTime / 60
	gen smallTalkTotal = SmallTalkMajor + SmallTalkYear + SmallTalkFromWhere
	gen smallTalk = smallTalkTotal
	gen comAsym = abs(2 - commSym)

	tab convinceKnowledgeable
	numlabel, add
	gen convince = . 
	replace convince = 0 if convinceKnowledgeable == 0
	replace convince = 1 if convinceKnowledgeable == 1 | convinceKnowledgeable == 2 | convinceKnowledgeable == 3
	
	gen convinceAsy = . 
	replace convinceAsy = 0 if convinceKnowledgeable == 0 | convinceKnowledgeable == 3 | convinceKnowledgeable == .
	replace convinceAsy = 1 if convinceKnowledgeable == 1 | convinceKnowledgeable == 2 

	tab talkAboutrule
	numlabel, add
	
	gen compoundInterest = talkAboutrule == 3 | talkAboutrule == 5
	gen rule72 = talkAboutrule == 1 | talkAboutrule == 2 | talkAboutrule == 5
		
	
	keep if receiver == 1
	keep if mplCheck == 1
	
	*** Defining vars
	
	// M1 are those who make good decisions, M2 those who make bad decisions	
	su part122sophRPartner, d
	gen part122sophRpartnerM1 = part122sophRPartner < r(p50)
	gen part122sophRpartnerM2 = part122sophRPartner >= r(p50) 
	
	gen interactionM00 = part12sophM1 == 0	& part122sophRpartnerM1 == 0
	gen interactionM01 = part12sophM1 == 0	& part122sophRpartnerM1 == 1
	gen interactionM10 = part12sophM1 == 1	& part122sophRpartnerM1 == 0
	gen interactionM11 = part12sophM1 == 1	& part122sophRpartnerM1 == 1
					
	replace interactionM00 = 0 if com == 0
	replace interactionM01 = 0 if com == 0						
	replace interactionM10 = 0 if com == 0
	replace interactionM11 = 0 if com == 0			

	gen differentSkills = interactionM01 == 1 | interactionM10 == 1

	local controlVars = "ib4.transcriber " 	// "`demo' `survey'"

	gen diffSkillsEduc = differentSkills * comEduc

	
	gen skEdT11 = differentSkills == 1 & comEduc == 1
	gen skEdT10 = differentSkills == 1 & comEduc == 0
	gen skEdT01 = differentSkills == 0 & comEduc == 1
	gen skEdT00 = differentSkills == 0 & comEduc == 0
	
	label var skEdT11 "different, educ"
	label var skEdT10 "different, no educ"
	label var skEdT01 "similar, educ"
	label var skEdT00 "similar, no educ"
	
	local controlVars = " " 	// "`demo' `survey'"
	

	
		
	gen interactionME00 = interactionM00 * comEduc
	gen interactionME01 = interactionM01 * comEduc 
	gen interactionME10 = interactionM10 * comEduc
	gen interactionME11 = interactionM11 * comEduc
	
	reg hSim interactionM* `controlVars' ib4.transcriber  if tagId == 1 & com == 1, nocons // cluster(transcriber) 
	
	
	*** Who discusses what? W/O FE *****	
	
	noisily: reg rule72 skEdT* `controlVars'  if tagId == 1 & com == 1, nocons  

		

	// compoundInterest rule72
	foreach var in hSim tDisc numProb smallTalk convinceAsy rule72 compoundInterest {
		local tex = "tex"
		if "`var'" == "hSim" {
			local replace = "replace"
		}
		else {
			local replace = " "
		}
	
	
		
		reg `var' skEdT* `controlVars'  if tagId == 1 & com == 1, nocons 
			test skEdT00 = skEdT01 
			local p12 = round(r(p), 0.001)
			test skEdT00 = skEdT10
			local p13 = round(r(p), 0.001)
			test skEdT00 = skEdT11 
			local p14 = round(r(p), 0.001)
			test skEdT01 = skEdT10 
			local p23 = round(r(p), 0.001)
			test skEdT01 = skEdT11 
			local p24 = round(r(p), 0.001)
			test skEdT10 = skEdT11 
			local p34 = round(r(p), 0.001)
			test skEdT00 = skEdT01 = skEdT10 = skEdT11
			local pJoint = r(p)
			
			test (skEdT01 - skEdT00) = (skEdT11 - skEdT10)
			local pdd = round(r(p), 0.001)
			
			
		outreg2 using "tables/transcriptionEducWoFE.tex", label dec(3) ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "diffInDiff", `pdd') ///
			`tex' `replace'
	
	}
	

	
	
	*** Who discusses what? W FE *****	 (Table B.6)
	
	// compoundInterest rule72
	foreach var in hSim tDisc numProb smallTalk convinceAsy rule72 compoundInterest {
		local tex = "tex"
		if "`var'" == "hSim" {
			local replace = "replace"
		}
		else {
			local replace = " "
		}
		if "`var'" == "tDisc" {
			local coderFE = " " 
		}
		else {
			local coderFE = "ib4.transcriber"
		}
		
		
			
		reg `var' skEdT* `controlVars' `coderFE'  if tagId == 1 & com == 1, nocons 
			test skEdT00 = skEdT01 
			local p12 = round(r(p), 0.001)
			test skEdT00 = skEdT10
			local p13 = round(r(p), 0.001)
			test skEdT00 = skEdT11 
			local p14 = round(r(p), 0.001)
			test skEdT01 = skEdT10 
			local p23 = round(r(p), 0.001)
			test skEdT01 = skEdT11 
			local p24 = round(r(p), 0.001)
			test skEdT10 = skEdT11 
			local p34 = round(r(p), 0.001)
			test skEdT00 = skEdT01 = skEdT10 = skEdT11
			local pJoint = r(p)
			
			test (skEdT01 - skEdT00) = (skEdT11 - skEdT10)
			local pdd = round(r(p), 0.001)
			
			
		outreg2 using "tables/transcriptionEducWFE.tex", label dec(3) ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "diffInDiff", `pdd') ///
			`tex' `replace'
	
	}
	
	reg rule72  comEduc if tagId == 1 & com == 1
	reg compoundInterest  comEduc if tagId == 1 & com == 1
	lincom _cons + comEduc

	
}	

********* TABLE 3: Main Effect of Communication		 		***************************
if 1 {
	// Main
	if 1 {

		clear
		use "data/mainDataCleaned.dta"
		
		
		sort pairId decisionNumber
		by pairId decisionNumber: egen maxComplex = max(deltaComplex) if pairId!=.
		by pairId decisionNumber: egen minComplex = min(deltaComplex) if pairId!=.	
		gen partnerDeltaComplex=.
		replace partnerDeltaComplex=maxComplex if deltaComplex==minComplex
		replace partnerDeltaComplex=minComplex if deltaComplex==maxComplex
	

		keep if receiver == 1
		keep if mplCheck == 1
		
		gen mimicryAbsDiffDelta=.
		replace mimicryAbsDiffDelta=absDiffDelta if part==1 | part==2
		replace mimicryAbsDiffDelta=absDiffDelta if part==3 & noComMain==1
		replace mimicryAbsDiffDelta=abs(partnerDeltaComplex-deltaSimple) if part==3 & ( comMain==1 | comEduc==1)
	
		gen mimicryAbsDiffDeltaBench=.
		replace mimicryAbsDiffDeltaBench=absD_0benchmark if part==1 | part==2
		replace mimicryAbsDiffDeltaBench=absD_0benchmark if part==3 & noComMain==1
		replace mimicryAbsDiffDeltaBench=MabsD_0benchmark if part==3 & ( comMain==1 | comEduc==1)
	
	
	
	
		drop partnerDeltaComplex maxComplex minComplex

		

		quietly {
			keep if stage23match ~= .
					
			capture: gen logHHinc = log(hhinc)
			capture: gen ageSq = age^2
			
			local keep_demoFirst = "male age ageSq ethnici nativel"
			local keep_demoSecond = "international  community"	// community is urban, suburban or rural
			local keep_cog = "cogAbility* mplCheck"	// variable knowledgeable is a coarsening of a continuous variable, and hence a suboptimal predictor
			local keep_financials = "logHHincPerCap cardown finLit part1sophistication part2FVsophistic part2sophistication finassistance cashadv cardroll"
			local keep_debrief = "heardBefore talk prepared followup"
			local keep_psych = "conformity bigFive_*" 
			local treatmentVars = "comEduc comMain noComMain noComNoAnn stage23match decisionKind"

			keep 	absDiffDelta absD_0bench  mimicryAbsDiffDelta mimicryAbsDiffDeltaBench main id comMain comEduc sdSimple  ///
					`keep_demoFirst' `keep_demoSecond' `keep_cog' `keep_financials' `keep_debrief' `keep_psych' `treatmentVars' ///
					international gpa com_part1soph* part1soph* part12soph* part122soph* *Partner partner* knowledgeable ///
					discussionTime finLitSum* gender partnerGender part1soph*
			
			order abs*
			
			reshape wide absDiffDelta absD_0benchmark mimicryAbsDiffDelta mimicryAbsDiffDeltaBench, i(id stage23match) j(decisionKind)
		
			gen improvement0 = absDiffDelta1 - absDiffDelta3 
			gen improvement1 = absDiffDelta1 - absDiffDelta2 

			gen impAlt0 = absD_0benchmark1 - absD_0benchmark3
			gen impAlt1 = absD_0benchmark1 - absD_0benchmark2
			
			gen improvementM0 = mimicryAbsDiffDelta1 - mimicryAbsDiffDelta3 
			gen improvementM1 = mimicryAbsDiffDelta1 - mimicryAbsDiffDelta2 

			gen impAltM0 = mimicryAbsDiffDeltaBench1 - mimicryAbsDiffDeltaBench3
			gen impAltM1 = mimicryAbsDiffDeltaBench1 - mimicryAbsDiffDeltaBench2
		



			
			// Explanation: 
			// 	The variable stage23match is 1 if the observation is from stage 2, 
			// 	2 if it is for stage3-Discussed, and 3 if it is for stage3-Not Discussed
			//	impAlt is the same thing, but taking preferences in the simple frame as 
			//	welfare-relevant benchmark
			
		
		}
		

		
		// Mentioned in main text:
		// level of financial competence
		su absDiffDelta1
		reg absDiffDelta1, cl(id)
		

		drop absDiffDelta1
		rename absDiffDelta2 absDiffDelta0
		rename absDiffDelta3 absDiffDelta1
		
		drop mimicryAbsDiffDelta1 mimicryAbsDiffDeltaBench1
		rename mimicryAbsDiffDelta2 mimicryAbsDiffDelta0
		rename mimicryAbsDiffDelta3 mimicryAbsDiffDelta1
		rename mimicryAbsDiffDeltaBench2 mimicryAbsDiffDeltaBench0
		rename mimicryAbsDiffDeltaBench3 mimicryAbsDiffDeltaBench1
					
		reshape long improvement impAlt improvementM impAltM absDiffDelta mimicryAbsDiffDelta mimicryAbsDiffDeltaBench, i(id stage23match) j(discussed)
		
		gen stage23discussed = 10 * discussed + stage23

		label var part1sophisti "FinComp Part 1"
		label var part2FVsophistic "FinComp Part 2FV"
		
		

		if 1 {
			
			xi: reg improvement comMain comEduc part12sophisti   `demo' i.stage23disc, cl(id) 
			local numSubj = e(N_clust)
			test comMain = comEduc
			local p = r(p)
			lincom comEduc - comMain
			local diffEduc = round(r(estimate), 0.001)
			local diffEducSD = round(r(se), 0.001)
			preserve 
				replace comMain = 0
				replace comEduc = 0
				xi: collapse improvement i.stage23disc comMain comEduc part12sophisti `demo'
				predict contrImprovement,
				predict contrImprovementSD, stdp
				su contrImprovement
				local contrImprovement = round(r(mean),0.001)
				su contrImprovementSD
				local contrImprovementSD = round(r(mean),0.001)
			restore
			outreg2 using "tables/tab3_4.tex",  keep(comMain comEduc  part12sophisti ) label dec(3)  ///
				addstat("#Subj", `numSubj', "P(comMain = comEduc)", `p', ///
				"impr0pred", `contrImprovement', "impr0predSD", `contrImprovementSD', ///
				"Indirect effect of education", `diffEduc', "Indir. SD", `diffEducSD') ///
				addtext("Sample", "main", "Demogr.", "Yes", "Survey", "-", "Psychological", "-") ///
				adec(3) tex replace 		

				
			**** Test: Do effects remain if initial time preferences taken as benchmark?
					
			xi: reg impAlt comMain comEduc part12sophisti   `demo' i.stage23disc, cl(id) 
			local numSubj = e(N_clust)
			test comMain = comEduc
			local p = r(p)
			lincom comEduc - comMain
			local diffEduc = round(r(estimate), 0.0001)
			local diffEducSD = round(r(se), 0.001)
			preserve 
				replace comMain = 0
				replace comEduc = 0
				xi: collapse impAlt i.stage23disc comMain comEduc part12sophisti `demo'
				predict contrImprovement,
				predict contrImprovementSD, stdp
				su contrImprovement
				local contrImprovement = round(r(mean),0.0001)
				su contrImprovementSD
				local contrImprovementSD = round(r(mean),0.001)
			restore
			outreg2 using "tables/tab3_4.tex",  keep(comMain comEduc  part12sophisti ) label dec(3)  ///
				addstat("#Subj", `numSubj', "P(comMain = comEduc)", `p', ///
				"impr0pred", `contrImprovement', "impr0predSD", `contrImprovementSD', ///
				"Indirect effect of education", `diffEduc', "Indir. SD", `diffEducSD') ///
				addtext("Sample", "main", "Demogr.", "Yes", "Survey", "-", "Psychological", "-") ///
				adec(3) tex 
						
		}
		
		if 1 {
			
			xi: reg improvementM comMain comEduc part12sophisti   `demo' i.stage23disc if discussed==1, cl(id) 
			local numSubj = e(N_clust)
			test comMain = comEduc
			local p = r(p)
			lincom comEduc - comMain
			local diffEduc = round(r(estimate), 0.001)
			local diffEducSD = round(r(se), 0.001)
			preserve 
				replace comMain = 0
				replace comEduc = 0
				xi: collapse improvementM i.stage23disc comMain comEduc part12sophisti `demo' if discussed==1
				predict contrImprovement,
				predict contrImprovementSD, stdp
				su contrImprovement
				local contrImprovement = round(r(mean),0.001)
				su contrImprovementSD
				local contrImprovementSD = round(r(mean),0.001)
			restore
			outreg2 using "tables/tab3_4.tex",  keep(comMain comEduc  part12sophisti ) label dec(3)  ///
				addstat("#Subj", `numSubj', "P(comMain = comEduc)", `p', ///
				"impr0pred", `contrImprovement', "impr0predSD", `contrImprovementSD', ///
				"Indirect effect of education", `diffEduc', "Indir. SD", `diffEducSD') ///
				addtext("Sample", "main", "Demogr.", "Yes", "Survey", "-", "Psychological", "-") ///
				adec(3) tex 		

				
			**** Test: Do effects remain if initial time preferences taken as benchmark?
					
			xi: reg impAltM comMain comEduc part12sophisti   `demo' i.stage23disc if discussed==1, cl(id) 
			local numSubj = e(N_clust)
			test comMain = comEduc
			local p = r(p)
			lincom comEduc - comMain
			local diffEduc = round(r(estimate), 0.0001)
			local diffEducSD = round(r(se), 0.001)
			preserve 
				replace comMain = 0
				replace comEduc = 0
				xi: collapse impAltM i.stage23disc comMain comEduc part12sophisti `demo' if discussed==1
				predict contrImprovement,
				predict contrImprovementSD, stdp
				su contrImprovement
				local contrImprovement = round(r(mean),0.0001)
				su contrImprovementSD
				local contrImprovementSD = round(r(mean),0.001)
			restore
			outreg2 using "tables/tab3_4.tex",  keep(comMain comEduc  part12sophisti ) label dec(3)  ///
				addstat("#Subj", `numSubj', "P(comMain = comEduc)", `p', ///
				"impr0pred", `contrImprovement', "impr0predSD", `contrImprovementSD', ///
				"Indirect effect of education", `diffEduc', "Indir. SD", `diffEducSD') ///
				addtext("Sample", "main", "Demogr.", "Yes", "Survey", "-", "Psychological", "-") ///
				adec(3) tex 
						
		}
		
		clear
		use "data/mainDataCleaned.dta"

		keep if receiver == 1
		keep if mplCheck == 1
		
		quietly {
			keep if stage23match ~= .
					
			capture: gen logHHinc = log(hhinc)
			capture: gen ageSq = age^2
			
			local keep_demoFirst = "male age ageSq ethnici nativel"
			local keep_demoSecond = "international  community"	// community is urban, suburban or rural
			local keep_cog = "cogAbility* mplCheck"	// variable knowledgeable is a coarsening of a continuous variable, and hence a suboptimal predictor
			local keep_financials = "logHHincPerCap cardown finLit part1sophistication part2FVsophistic part2sophistication finassistance cashadv cardroll"
			local keep_debrief = "heardBefore talk prepared followup"
			local keep_psych = "conformity bigFive_*" 
			local treatmentVars = "comEduc comMain noComMain noComNoAnn stage23match decisionKind"

			keep 	absDiffDelta absD_0bench main id comMain comEduc sdSimple  ///
					`keep_demoFirst' `keep_demoSecond' `keep_cog' `keep_financials' `keep_debrief' `keep_psych' `treatmentVars' ///
					international gpa com_part1soph* part1soph* part12soph* part122soph* *Partner partner* knowledgeable ///
					discussionTime finLitSum* gender partnerGender part1soph*
			
			order abs*
			
			reshape wide absDiffDelta absD_0benchmark, i(id stage23match) j(decisionKind)
		
			gen improvement0 = absDiffDelta1 - absDiffDelta3 
			gen improvement1 = absDiffDelta1 - absDiffDelta2 

			gen improvementA0 = absD_0benchmark1 - absD_0benchmark3
			gen improvementA1 = absD_0benchmark1 - absD_0benchmark2


			// Explanation: 
			// 	The variable stage23match is 1 if the observation is from stage 2, 
			// 	2 if it is for stage3-nonDiscussed, and 3 if it is for stage3-discussed
			
		}		
		

		
		sort id
		by id: egen impr0 = mean(improvement0)
		by id: egen impr1 = mean(improvement1)
		egen tagDND = tag(id)
		


		local controlsHere = "part12sophistic  `demo'  "
		xi: sureg 	(impr0 comMain comEduc `controlsHere') ///
				(impr1 comMain comEduc `controlsHere') ///
				if tag == 1

		preserve
				replace comMain = 0
				replace comEduc = 0
				xi: collapse impr* comMain comEduc `controlsHere'
				predict impr0pred, eq(impr0)
				predict impr1pred, eq(impr1)
				predict impr0predSD, eq(impr0) stdp
				predict impr1predSD, eq(impr1) stdp
				su impr0pred
				local impr0pred = round(r(mean),0.001)
				su impr0predSD
				local impr0predSD = round(r(mean),0.001)
				su impr1pred
				local impr1pred = round(r(mean),0.001)
				su impr1predSD
				local impr1predSD = round(r(mean),0.001)
		restore
		test [impr0]comMain = [impr1]comMain
		local pDND_inMain = round(r(p), 0.001)
		test [impr0]comEduc = [impr1]comEduc
		local pDND_inEduc = round(r(p), 0.001)
		test [impr0]comMain = [impr0]comEduc
		local pMainEduc_inND = round(r(p), 0.001)
		test [impr1]comMain = [impr1]comEduc
		local pMainEduc_inD = round(r(p), 0.001)
		test [impr0]comMain - [impr1]comMain = [impr0]comEduc - [impr1]comEduc
		local diffInDiff = round(r(p), 0.001)
		
		outreg2 using "tables/tab3_4.tex", eqdrop(im0_2 im0_3 im0_4 im0_5 im0_6 im1_2 im1_3 im1_4 im1_5 im1_6) keep(com*) label dec(3)  ///
				addtext("Sample", "main", "FinComp1_2", "Yes", "Demogr.", "Yes", "Survey", "-", "Psychological", "-") ///
				addstat("impr0pred", `impr0pred', "impr0predSD", `impr0predSD', "impr1pred", `impr1pred', "impr1predSD", `impr1predSD', ///
					"pDND_inMain", `pDND_inMain', "pDND_inEduc", `pDND_inEduc', "pMainEduc_inND", `pMainEduc_inND', "pMainEduc_inD", `pMainEduc_inD', "diffInDiff", `diffInDiff') ///
				adec(3) tex(frag) 	
		
		
		sort id
		by id: egen impA0 = mean(improvementA0)
		by id: egen impA1 = mean(improvementA1)
				

		local controlsHere = "part12sophistic  `demo'  "
		xi: sureg 	(impA0 comMain comEduc `controlsHere') ///
				(impA1 comMain comEduc `controlsHere') ///
				if tag == 1

		preserve
				replace comMain = 0
				replace comEduc = 0
				xi: collapse impA* comMain comEduc `controlsHere'
				predict impA0pred, eq(impA0)
				predict impA1pred, eq(impA1)
				predict impA0predSD, eq(impA0) stdp
				predict impA1predSD, eq(impA1) stdp
				su impA0pred
				local impA0pred = round(r(mean),0.001)
				su impA0predSD
				local impA0predSD = round(r(mean),0.001)
				su impA1pred
				local impA1pred = round(r(mean),0.001)
				su impA1predSD
				local impA1predSD = round(r(mean),0.001)
		restore
		test [impA0]comMain = [impA1]comMain
		local pDND_inMain = round(r(p), 0.001)
		test [impA0]comEduc = [impA1]comEduc
		local pDND_inEduc = round(r(p), 0.001)
		test [impA0]comMain = [impA0]comEduc
		local pMainEduc_inND = round(r(p), 0.001)
		test [impA1]comMain = [impA1]comEduc
		local pMainEduc_inD = round(r(p), 0.001)
		test [impA0]comMain - [impA1]comMain = [impA0]comEduc - [impA1]comEduc
		local diffInDiff = round(r(p), 0.001)
		outreg2 using "tables/tab3_4.tex", eqdrop(im0_2 im0_3 im0_4 im0_5 im0_6 im1_2 im1_3 im1_4 im1_5 im1_6) keep(com*) label dec(3)  ///
				addtext("Sample", "main", "FinComp1_2", "Yes", "Demogr.", "Yes", "Survey", "-", "Psychological", "-") ///
				addstat("impr0pred", `impA0pred', "impr0predSD", `impA0predSD', "impr1pred", `impA1pred', "impr1predSD", `impA1predSD', ///
					"pDND_inMain", `pDND_inMain', "pDND_inEduc", `pDND_inEduc', "pMainEduc_inND", `pMainEduc_inND', "pMainEduc_inD", `pMainEduc_inD', "diffInDiff", `diffInDiff') ///
				adec(3) tex(frag) 	

	}

	// Without demographic controls (Table B.2)
	if 1 {

		clear
		use "data/mainDataCleaned.dta"

		sort pairId decisionNumber
		by pairId decisionNumber: egen maxComplex = max(deltaComplex) if pairId!=.
		by pairId decisionNumber: egen minComplex = min(deltaComplex) if pairId!=.	
		gen partnerDeltaComplex=.
		replace partnerDeltaComplex=maxComplex if deltaComplex==minComplex
		replace partnerDeltaComplex=minComplex if deltaComplex==maxComplex
	

		keep if receiver == 1
		keep if mplCheck == 1
		
		gen mimicryAbsDiffDelta=.
		replace mimicryAbsDiffDelta=absDiffDelta if part==1 | part==2
		replace mimicryAbsDiffDelta=absDiffDelta if part==3 & noComMain==1
		replace mimicryAbsDiffDelta=abs(partnerDeltaComplex-deltaSimple) if part==3 & ( comMain==1 | comEduc==1)
	
		gen mimicryAbsDiffDeltaBench=.
		replace mimicryAbsDiffDeltaBench=absD_0benchmark if part==1 | part==2
		replace mimicryAbsDiffDeltaBench=absD_0benchmark if part==3 & noComMain==1
		replace mimicryAbsDiffDeltaBench=MabsD_0benchmark if part==3 & ( comMain==1 | comEduc==1)
	
	
	
	
		drop partnerDeltaComplex maxComplex minComplex

		

		quietly {
			keep if stage23match ~= .
					
			capture: gen logHHinc = log(hhinc)
			capture: gen ageSq = age^2
			
			local keep_demoFirst = "male age ageSq ethnici nativel"
			local keep_demoSecond = "international  community"	// community is urban, suburban or rural
			local keep_cog = "cogAbility* mplCheck"	// variable knowledgeable is a coarsening of a continuous variable, and hence a suboptimal predictor
			local keep_financials = "logHHincPerCap cardown finLit part1sophistication part2FVsophistic part2sophistication finassistance cashadv cardroll"
			local keep_debrief = "heardBefore talk prepared followup"
			local keep_psych = "conformity bigFive_*" 
			local treatmentVars = "comEduc comMain noComMain noComNoAnn stage23match decisionKind"

			keep 	absDiffDelta absD_0bench  mimicryAbsDiffDelta mimicryAbsDiffDeltaBench main id comMain comEduc sdSimple  ///
					`keep_demoFirst' `keep_demoSecond' `keep_cog' `keep_financials' `keep_debrief' `keep_psych' `treatmentVars' ///
					international gpa com_part1soph* part1soph* part12soph* part122soph* *Partner partner* knowledgeable ///
					discussionTime finLitSum* gender partnerGender part1soph*
			
			order abs*
			
			reshape wide absDiffDelta absD_0benchmark mimicryAbsDiffDelta mimicryAbsDiffDeltaBench, i(id stage23match) j(decisionKind)
		
			gen improvement0 = absDiffDelta1 - absDiffDelta3 
			gen improvement1 = absDiffDelta1 - absDiffDelta2 

			gen impAlt0 = absD_0benchmark1 - absD_0benchmark3
			gen impAlt1 = absD_0benchmark1 - absD_0benchmark2
			
			gen improvementM0 = mimicryAbsDiffDelta1 - mimicryAbsDiffDelta3 
			gen improvementM1 = mimicryAbsDiffDelta1 - mimicryAbsDiffDelta2 

			gen impAltM0 = mimicryAbsDiffDeltaBench1 - mimicryAbsDiffDeltaBench3
			gen impAltM1 = mimicryAbsDiffDeltaBench1 - mimicryAbsDiffDeltaBench2
		



			
			// Explanation: 
			// 	The variable stage23match is 1 if the observation is from stage 2, 
			// 	2 if it is for stage3-Discussed, and 3 if it is for stage3-Not Discussed
			//	impAlt is the same thing, but taking preferences in the simple frame as 
			//	welfare-relevant benchmark
			
		
		}
		

		
		// Mentioned in main text:
		// level of financial competence
		su absDiffDelta1
		reg absDiffDelta1, cl(id)
		

		drop absDiffDelta1
		rename absDiffDelta2 absDiffDelta0
		rename absDiffDelta3 absDiffDelta1
		
		drop mimicryAbsDiffDelta1 mimicryAbsDiffDeltaBench1
		rename mimicryAbsDiffDelta2 mimicryAbsDiffDelta0
		rename mimicryAbsDiffDelta3 mimicryAbsDiffDelta1
		rename mimicryAbsDiffDeltaBench2 mimicryAbsDiffDeltaBench0
		rename mimicryAbsDiffDeltaBench3 mimicryAbsDiffDeltaBench1
					
		reshape long improvement impAlt improvementM impAltM absDiffDelta mimicryAbsDiffDelta mimicryAbsDiffDeltaBench, i(id stage23match) j(discussed)
		
		gen stage23discussed = 10 * discussed + stage23

		label var part1sophisti "FinComp Part 1"
		label var part2FVsophistic "FinComp Part 2FV"
		

		if 1 {
			
		
				
			xi: reg improvement comMain comEduc part12sophisti   i.stage23disc, cl(id) 
			local numSubj = e(N_clust)
			test comMain = comEduc
			local p = r(p)
			lincom comEduc - comMain
			local diffEduc = round(r(estimate), 0.001)
			local diffEducSD = round(r(se), 0.001)
			preserve 
				replace comMain = 0
				replace comEduc = 0
				xi: collapse improvement i.stage23disc comMain comEduc part12sophisti 
				predict contrImprovement,
				predict contrImprovementSD, stdp
				su contrImprovement
				local contrImprovement = round(r(mean),0.001)
				su contrImprovementSD
				local contrImprovementSD = round(r(mean),0.001)
			restore
			outreg2 using "tables/tab3_4_cont0.tex",  keep(comMain comEduc  part12sophisti ) label dec(3)  ///
				addstat("#Subj", `numSubj', "P(comMain = comEduc)", `p', ///
				"impr0pred", `contrImprovement', "impr0predSD", `contrImprovementSD', ///
				"Indirect effect of education", `diffEduc', "Indir. SD", `diffEducSD') ///
				addtext("Sample", "main", "Demogr.", "Yes", "Survey", "-", "Psychological", "-") ///
				adec(3) tex replace 		

				
			**** Test: Do effects remain if initial time preferences taken as benchmark?
					
			xi: reg impAlt comMain comEduc part12sophisti    i.stage23disc, cl(id) 
			local numSubj = e(N_clust)
			test comMain = comEduc
			local p = r(p)
			lincom comEduc - comMain
			local diffEduc = round(r(estimate), 0.0001)
			local diffEducSD = round(r(se), 0.001)
			preserve 
				replace comMain = 0
				replace comEduc = 0
				xi: collapse impAlt i.stage23disc comMain comEduc part12sophisti 
				predict contrImprovement,
				predict contrImprovementSD, stdp
				su contrImprovement
				local contrImprovement = round(r(mean),0.0001)
				su contrImprovementSD
				local contrImprovementSD = round(r(mean),0.001)
			restore
			outreg2 using "tables/tab3_4_cont0.tex",  keep(comMain comEduc  part12sophisti ) label dec(3)  ///
				addstat("#Subj", `numSubj', "P(comMain = comEduc)", `p', ///
				"impr0pred", `contrImprovement', "impr0predSD", `contrImprovementSD', ///
				"Indirect effect of education", `diffEduc', "Indir. SD", `diffEducSD') ///
				addtext("Sample", "main", "Demogr.", "Yes", "Survey", "-", "Psychological", "-") ///
				adec(3) tex 
						
		}
		if 1 {
			
		
				
			xi: reg improvementM comMain comEduc part12sophisti   i.stage23disc if discussed==1, cl(id) 
			local numSubj = e(N_clust)
			test comMain = comEduc
			local p = r(p)
			lincom comEduc - comMain
			local diffEduc = round(r(estimate), 0.001)
			local diffEducSD = round(r(se), 0.001)
			preserve 
				replace comMain = 0
				replace comEduc = 0
				xi: collapse improvementM i.stage23disc comMain comEduc part12sophisti if discussed==1
				predict contrImprovement,
				predict contrImprovementSD, stdp
				su contrImprovement
				local contrImprovement = round(r(mean),0.001)
				su contrImprovementSD
				local contrImprovementSD = round(r(mean),0.001)
			restore
			outreg2 using "tables/tab3_4_cont0.tex",  keep(comMain comEduc  part12sophisti ) label dec(3)  ///
				addstat("#Subj", `numSubj', "P(comMain = comEduc)", `p', ///
				"impr0pred", `contrImprovement', "impr0predSD", `contrImprovementSD', ///
				"Indirect effect of education", `diffEduc', "Indir. SD", `diffEducSD') ///
				addtext("Sample", "main", "Demogr.", "Yes", "Survey", "-", "Psychological", "-") ///
				adec(3) tex 		

				
			**** Test: Do effects remain if initial time preferences taken as benchmark?
					
			xi: reg impAltM comMain comEduc part12sophisti    i.stage23disc if discussed==1, cl(id) 
			local numSubj = e(N_clust)
			test comMain = comEduc
			local p = r(p)
			lincom comEduc - comMain
			local diffEduc = round(r(estimate), 0.0001)
			local diffEducSD = round(r(se), 0.001)
			preserve 
				replace comMain = 0
				replace comEduc = 0
				xi: collapse impAltM i.stage23disc comMain comEduc part12sophisti if discussed==1
				predict contrImprovement,
				predict contrImprovementSD, stdp
				su contrImprovement
				local contrImprovement = round(r(mean),0.0001)
				su contrImprovementSD
				local contrImprovementSD = round(r(mean),0.001)
			restore
			outreg2 using "tables/tab3_4_cont0.tex",  keep(comMain comEduc  part12sophisti ) label dec(3)  ///
				addstat("#Subj", `numSubj', "P(comMain = comEduc)", `p', ///
				"impr0pred", `contrImprovement', "impr0predSD", `contrImprovementSD', ///
				"Indirect effect of education", `diffEduc', "Indir. SD", `diffEducSD') ///
				addtext("Sample", "main", "Demogr.", "Yes", "Survey", "-", "Psychological", "-") ///
				adec(3) tex 
						
		}
	
		clear
		use "data/mainDataCleaned.dta"

		keep if receiver == 1
		keep if mplCheck == 1
		
		quietly {
			keep if stage23match ~= .
					
			capture: gen logHHinc = log(hhinc)
			capture: gen ageSq = age^2
			
			local keep_demoFirst = "male age ageSq ethnici nativel"
			local keep_demoSecond = "international  community"	// community is urban, suburban or rural
			local keep_cog = "cogAbility* mplCheck"	// variable knowledgeable is a coarsening of a continuous variable, and hence a suboptimal predictor
			local keep_financials = "logHHincPerCap cardown finLit part1sophistication part2FVsophistic part2sophistication finassistance cashadv cardroll"
			local keep_debrief = "heardBefore talk prepared followup"
			local keep_psych = "conformity bigFive_*" 
			local treatmentVars = "comEduc comMain noComMain noComNoAnn stage23match decisionKind"

			keep 	absDiffDelta absD_0bench main id comMain comEduc sdSimple  ///
					`keep_demoFirst' `keep_demoSecond' `keep_cog' `keep_financials' `keep_debrief' `keep_psych' `treatmentVars' ///
					international gpa com_part1soph* part1soph* part12soph* part122soph* *Partner partner* knowledgeable ///
					discussionTime finLitSum* gender partnerGender part1soph*
			
			order abs*
			
			reshape wide absDiffDelta absD_0benchmark, i(id stage23match) j(decisionKind)
		
			gen improvement0 = absDiffDelta1 - absDiffDelta3 
			gen improvement1 = absDiffDelta1 - absDiffDelta2 

			gen improvementA0 = absD_0benchmark1 - absD_0benchmark3
			gen improvementA1 = absD_0benchmark1 - absD_0benchmark2


			// Explanation: 
			// 	The variable stage23match is 1 if the observation is from stage 2, 
			// 	2 if it is for stage3-nonDiscussed, and 3 if it is for stage3-discussed
			
		}		
		

		
		sort id
		by id: egen impr0 = mean(improvement0)
		by id: egen impr1 = mean(improvement1)
		egen tagDND = tag(id)
		


		local controlsHere = "part12sophistic  "
		xi: sureg 	(impr0 comMain comEduc `controlsHere') ///
				(impr1 comMain comEduc `controlsHere') ///
				if tag == 1

		preserve
				replace comMain = 0
				replace comEduc = 0
				xi: collapse impr* comMain comEduc `controlsHere'
				predict impr0pred, eq(impr0)
				predict impr1pred, eq(impr1)
				predict impr0predSD, eq(impr0) stdp
				predict impr1predSD, eq(impr1) stdp
				su impr0pred
				local impr0pred = round(r(mean),0.001)
				su impr0predSD
				local impr0predSD = round(r(mean),0.001)
				su impr1pred
				local impr1pred = round(r(mean),0.001)
				su impr1predSD
				local impr1predSD = round(r(mean),0.001)
		restore
		test [impr0]comMain = [impr1]comMain
		local pDND_inMain = round(r(p), 0.001)
		test [impr0]comEduc = [impr1]comEduc
		local pDND_inEduc = round(r(p), 0.001)
		test [impr0]comMain = [impr0]comEduc
		local pMainEduc_inND = round(r(p), 0.001)
		test [impr1]comMain = [impr1]comEduc
		local pMainEduc_inD = round(r(p), 0.001)
		test [impr0]comMain - [impr1]comMain = [impr0]comEduc - [impr1]comEduc
		local diffInDiff = round(r(p), 0.001)
		
		outreg2 using "tables/tab3_4_cont0.tex", eqdrop(im0_2 im0_3 im0_4 im0_5 im0_6 im1_2 im1_3 im1_4 im1_5 im1_6) keep(com*) label dec(3)  ///
				addtext("Sample", "main", "FinComp1_2", "Yes", "Demogr.", "Yes", "Survey", "-", "Psychological", "-") ///
				addstat("impr0pred", `impr0pred', "impr0predSD", `impr0predSD', "impr1pred", `impr1pred', "impr1predSD", `impr1predSD', ///
					"pDND_inMain", `pDND_inMain', "pDND_inEduc", `pDND_inEduc', "pMainEduc_inND", `pMainEduc_inND', "pMainEduc_inD", `pMainEduc_inD', "diffInDiff", `diffInDiff') ///
				adec(3) tex(frag) 	
		
		
		sort id
		by id: egen impA0 = mean(improvementA0)
		by id: egen impA1 = mean(improvementA1)
				

		local controlsHere = "part12sophistic   "
		xi: sureg 	(impA0 comMain comEduc `controlsHere') ///
				(impA1 comMain comEduc `controlsHere') ///
				if tag == 1

		preserve
				replace comMain = 0
				replace comEduc = 0
				xi: collapse impA* comMain comEduc `controlsHere'
				predict impA0pred, eq(impA0)
				predict impA1pred, eq(impA1)
				predict impA0predSD, eq(impA0) stdp
				predict impA1predSD, eq(impA1) stdp
				su impA0pred
				local impA0pred = round(r(mean),0.001)
				su impA0predSD
				local impA0predSD = round(r(mean),0.001)
				su impA1pred
				local impA1pred = round(r(mean),0.001)
				su impA1predSD
				local impA1predSD = round(r(mean),0.001)
		restore
		test [impA0]comMain = [impA1]comMain
		local pDND_inMain = round(r(p), 0.001)
		test [impA0]comEduc = [impA1]comEduc
		local pDND_inEduc = round(r(p), 0.001)
		test [impA0]comMain = [impA0]comEduc
		local pMainEduc_inND = round(r(p), 0.001)
		test [impA1]comMain = [impA1]comEduc
		local pMainEduc_inD = round(r(p), 0.001)
		test [impA0]comMain - [impA1]comMain = [impA0]comEduc - [impA1]comEduc
		local diffInDiff = round(r(p), 0.001)
		outreg2 using "tables/tab3_4_cont0.tex", eqdrop(im0_2 im0_3 im0_4 im0_5 im0_6 im1_2 im1_3 im1_4 im1_5 im1_6) keep(com*) label dec(3)  ///
				addtext("Sample", "main", "FinComp1_2", "Yes", "Demogr.", "Yes", "Survey", "-", "Psychological", "-") ///
				addstat("impr0pred", `impA0pred', "impr0predSD", `impA0predSD', "impr1pred", `impA1pred', "impr1predSD", `impA1predSD', ///
					"pDND_inMain", `pDND_inMain', "pDND_inEduc", `pDND_inEduc', "pMainEduc_inND", `pMainEduc_inND', "pMainEduc_inD", `pMainEduc_inD', "diffInDiff", `diffInDiff') ///
				adec(3) tex(frag) 	

	}

	// Adding financial and psychological controls (Table B.3)
	if 1 {

		clear
		use "data/mainDataCleaned.dta"

		sort pairId decisionNumber
		by pairId decisionNumber: egen maxComplex = max(deltaComplex) if pairId!=.
		by pairId decisionNumber: egen minComplex = min(deltaComplex) if pairId!=.	
		gen partnerDeltaComplex=.
		replace partnerDeltaComplex=maxComplex if deltaComplex==minComplex
		replace partnerDeltaComplex=minComplex if deltaComplex==maxComplex
	

		keep if receiver == 1
		keep if mplCheck == 1
		
		gen mimicryAbsDiffDelta=.
		replace mimicryAbsDiffDelta=absDiffDelta if part==1 | part==2
		replace mimicryAbsDiffDelta=absDiffDelta if part==3 & noComMain==1
		replace mimicryAbsDiffDelta=abs(partnerDeltaComplex-deltaSimple) if part==3 & ( comMain==1 | comEduc==1)
	
		gen mimicryAbsDiffDeltaBench=.
		replace mimicryAbsDiffDeltaBench=absD_0benchmark if part==1 | part==2
		replace mimicryAbsDiffDeltaBench=absD_0benchmark if part==3 & noComMain==1
		replace mimicryAbsDiffDeltaBench=MabsD_0benchmark if part==3 & ( comMain==1 | comEduc==1)
	
	
	
	
		drop partnerDeltaComplex maxComplex minComplex

		

		quietly {
			keep if stage23match ~= .
					
			capture: gen logHHinc = log(hhinc)
			capture: gen ageSq = age^2
			
			local keep_demoFirst = "male age ageSq ethnici nativel"
			local keep_demoSecond = "international  community"	// community is urban, suburban or rural
			local keep_cog = "cogAbility* mplCheck"	// variable knowledgeable is a coarsening of a continuous variable, and hence a suboptimal predictor
			local keep_financials = "logHHincPerCap cardown finLit part1sophistication part2FVsophistic part2sophistication finassistance cashadv cardroll"
			local keep_debrief = "heardBefore talk prepared followup"
			local keep_psych = "conformity bigFive_*" 
			local treatmentVars = "comEduc comMain noComMain noComNoAnn stage23match decisionKind"

			keep 	absDiffDelta absD_0bench  mimicryAbsDiffDelta mimicryAbsDiffDeltaBench main id comMain comEduc sdSimple  ///
					`keep_demoFirst' `keep_demoSecond' `keep_cog' `keep_financials' `keep_debrief' `keep_psych' `treatmentVars' ///
					international gpa com_part1soph* part1soph* part12soph* part122soph* *Partner partner* knowledgeable ///
					discussionTime finLitSum* gender partnerGender part1soph*
			
			order abs*
			
			reshape wide absDiffDelta absD_0benchmark mimicryAbsDiffDelta mimicryAbsDiffDeltaBench, i(id stage23match) j(decisionKind)
		
			gen improvement0 = absDiffDelta1 - absDiffDelta3 
			gen improvement1 = absDiffDelta1 - absDiffDelta2 

			gen impAlt0 = absD_0benchmark1 - absD_0benchmark3
			gen impAlt1 = absD_0benchmark1 - absD_0benchmark2
			
			gen improvementM0 = mimicryAbsDiffDelta1 - mimicryAbsDiffDelta3 
			gen improvementM1 = mimicryAbsDiffDelta1 - mimicryAbsDiffDelta2 

			gen impAltM0 = mimicryAbsDiffDeltaBench1 - mimicryAbsDiffDeltaBench3
			gen impAltM1 = mimicryAbsDiffDeltaBench1 - mimicryAbsDiffDeltaBench2
		



			
			// Explanation: 
			// 	The variable stage23match is 1 if the observation is from stage 2, 
			// 	2 if it is for stage3-Discussed, and 3 if it is for stage3-Not Discussed
			//	impAlt is the same thing, but taking preferences in the simple frame as 
			//	welfare-relevant benchmark
			
		
		}
		

		
		// Mentioned in main text:
		// level of financial competence
		su absDiffDelta1
		reg absDiffDelta1, cl(id)
		

		drop absDiffDelta1
		rename absDiffDelta2 absDiffDelta0
		rename absDiffDelta3 absDiffDelta1
		
		drop mimicryAbsDiffDelta1 mimicryAbsDiffDeltaBench1
		rename mimicryAbsDiffDelta2 mimicryAbsDiffDelta0
		rename mimicryAbsDiffDelta3 mimicryAbsDiffDelta1
		rename mimicryAbsDiffDeltaBench2 mimicryAbsDiffDeltaBench0
		rename mimicryAbsDiffDeltaBench3 mimicryAbsDiffDeltaBench1
					
		reshape long improvement impAlt improvementM impAltM absDiffDelta mimicryAbsDiffDelta mimicryAbsDiffDeltaBench, i(id stage23match) j(discussed)
		
		gen stage23discussed = 10 * discussed + stage23

		label var part1sophisti "FinComp Part 1"
		label var part2FVsophistic "FinComp Part 2FV"
		

		if 1 {
			
		
				
			xi: reg improvement comMain comEduc part12sophisti   `demo'  `survey' `psychCog' i.stage23disc, cl(id) 
			local numSubj = e(N_clust)
			test comMain = comEduc
			local p = r(p)
			lincom comEduc - comMain
			local diffEduc = round(r(estimate), 0.001)
			local diffEducSD = round(r(se), 0.001)
			preserve 
				replace comMain = 0
				replace comEduc = 0
				xi: collapse improvement i.stage23disc comMain comEduc part12sophisti `demo'  `survey' `psychCog'
				predict contrImprovement,
				predict contrImprovementSD, stdp
				su contrImprovement
				local contrImprovement = round(r(mean),0.001)
				su contrImprovementSD
				local contrImprovementSD = round(r(mean),0.001)
			restore
			outreg2 using "tables/tab3_4_cont1.tex",  keep(comMain comEduc  part12sophisti ) label dec(3)  ///
				addstat("#Subj", `numSubj', "P(comMain = comEduc)", `p', ///
				"impr0pred", `contrImprovement', "impr0predSD", `contrImprovementSD', ///
				"Indirect effect of education", `diffEduc', "Indir. SD", `diffEducSD') ///
				addtext("Sample", "main", "Demogr.", "Yes", "Survey", "-", "Psychological", "-") ///
				adec(3) tex replace 		

				
			**** Test: Do effects remain if initial time preferences taken as benchmark?
					
			xi: reg impAlt comMain comEduc part12sophisti   `demo'  `survey' `psychCog' i.stage23disc, cl(id) 
			local numSubj = e(N_clust)
			test comMain = comEduc
			local p = r(p)
			lincom comEduc - comMain
			local diffEduc = round(r(estimate), 0.0001)
			local diffEducSD = round(r(se), 0.001)
			preserve 
				replace comMain = 0
				replace comEduc = 0
				xi: collapse impAlt i.stage23disc comMain comEduc part12sophisti `demo'  `survey' `psychCog'
				predict contrImprovement,
				predict contrImprovementSD, stdp
				su contrImprovement
				local contrImprovement = round(r(mean),0.0001)
				su contrImprovementSD
				local contrImprovementSD = round(r(mean),0.001)
			restore
			outreg2 using "tables/tab3_4_cont1.tex",  keep(comMain comEduc  part12sophisti ) label dec(3)  ///
				addstat("#Subj", `numSubj', "P(comMain = comEduc)", `p', ///
				"impr0pred", `contrImprovement', "impr0predSD", `contrImprovementSD', ///
				"Indirect effect of education", `diffEduc', "Indir. SD", `diffEducSD') ///
				addtext("Sample", "main", "Demogr.", "Yes", "Survey", "-", "Psychological", "-") ///
				adec(3) tex 
						
		}
		if 1 {
			
		
				
			xi: reg improvementM comMain comEduc part12sophisti   `demo'  `survey' `psychCog' i.stage23disc if discussed==1, cl(id) 
			local numSubj = e(N_clust)
			test comMain = comEduc
			local p = r(p)
			lincom comEduc - comMain
			local diffEduc = round(r(estimate), 0.001)
			local diffEducSD = round(r(se), 0.001)
			preserve 
				replace comMain = 0
				replace comEduc = 0
				xi: collapse improvementM i.stage23disc comMain comEduc part12sophisti `demo'  `survey' `psychCog' if discussed==1
				predict contrImprovement,
				predict contrImprovementSD, stdp
				su contrImprovement
				local contrImprovement = round(r(mean),0.001)
				su contrImprovementSD
				local contrImprovementSD = round(r(mean),0.001)
			restore
			outreg2 using "tables/tab3_4_cont1.tex",  keep(comMain comEduc  part12sophisti ) label dec(3)  ///
				addstat("#Subj", `numSubj', "P(comMain = comEduc)", `p', ///
				"impr0pred", `contrImprovement', "impr0predSD", `contrImprovementSD', ///
				"Indirect effect of education", `diffEduc', "Indir. SD", `diffEducSD') ///
				addtext("Sample", "main", "Demogr.", "Yes", "Survey", "-", "Psychological", "-") ///
				adec(3) tex 		

				
			**** Test: Do effects remain if initial time preferences taken as benchmark?
					
			xi: reg impAltM comMain comEduc part12sophisti   `demo'  `survey' `psychCog' i.stage23disc if discussed==1, cl(id) 
			local numSubj = e(N_clust)
			test comMain = comEduc
			local p = r(p)
			lincom comEduc - comMain
			local diffEduc = round(r(estimate), 0.0001)
			local diffEducSD = round(r(se), 0.001)
			preserve 
				replace comMain = 0
				replace comEduc = 0
				xi: collapse impAltM i.stage23disc comMain comEduc part12sophisti `demo'  `survey' `psychCog' if discussed==1
				predict contrImprovement,
				predict contrImprovementSD, stdp
				su contrImprovement
				local contrImprovement = round(r(mean),0.0001)
				su contrImprovementSD
				local contrImprovementSD = round(r(mean),0.001)
			restore
			outreg2 using "tables/tab3_4_cont1.tex",  keep(comMain comEduc  part12sophisti ) label dec(3)  ///
				addstat("#Subj", `numSubj', "P(comMain = comEduc)", `p', ///
				"impr0pred", `contrImprovement', "impr0predSD", `contrImprovementSD', ///
				"Indirect effect of education", `diffEduc', "Indir. SD", `diffEducSD') ///
				addtext("Sample", "main", "Demogr.", "Yes", "Survey", "-", "Psychological", "-") ///
				adec(3) tex 
						
		}
		
		clear
		use "data/mainDataCleaned.dta"

		keep if receiver == 1
		keep if mplCheck == 1
		
		quietly {
			keep if stage23match ~= .
					
			capture: gen logHHinc = log(hhinc)
			capture: gen ageSq = age^2
			
			local keep_demoFirst = "male age ageSq ethnici nativel"
			local keep_demoSecond = "international  community"	// community is urban, suburban or rural
			local keep_cog = "cogAbility* mplCheck"	// variable knowledgeable is a coarsening of a continuous variable, and hence a suboptimal predictor
			local keep_financials = "logHHincPerCap cardown finLit part1sophistication part2FVsophistic part2sophistication finassistance cashadv cardroll"
			local keep_debrief = "heardBefore talk prepared followup"
			local keep_psych = "conformity bigFive_*" 
			local treatmentVars = "comEduc comMain noComMain noComNoAnn stage23match decisionKind"

			keep 	absDiffDelta absD_0bench main id comMain comEduc sdSimple  ///
					`keep_demoFirst' `keep_demoSecond' `keep_cog' `keep_financials' `keep_debrief' `keep_psych' `treatmentVars' ///
					international gpa com_part1soph* part1soph* part12soph* part122soph* *Partner partner* knowledgeable ///
					discussionTime finLitSum* gender partnerGender part1soph*
			
			order abs*
			
			reshape wide absDiffDelta absD_0benchmark, i(id stage23match) j(decisionKind)
		
			gen improvement0 = absDiffDelta1 - absDiffDelta3 
			gen improvement1 = absDiffDelta1 - absDiffDelta2 

			gen improvementA0 = absD_0benchmark1 - absD_0benchmark3
			gen improvementA1 = absD_0benchmark1 - absD_0benchmark2


			// Explanation: 
			// 	The variable stage23match is 1 if the observation is from stage 2, 
			// 	2 if it is for stage3-nonDiscussed, and 3 if it is for stage3-discussed
			
		}		
		

		
		sort id
		by id: egen impr0 = mean(improvement0)
		by id: egen impr1 = mean(improvement1)
		egen tagDND = tag(id)
		


		local controlsHere = "part12sophistic  `demo'   `survey' `psychCog' "
		xi: sureg 	(impr0 comMain comEduc `controlsHere') ///
				(impr1 comMain comEduc `controlsHere') ///
				if tag == 1

		preserve
				replace comMain = 0
				replace comEduc = 0
				xi: collapse impr* comMain comEduc `controlsHere'
				predict impr0pred, eq(impr0)
				predict impr1pred, eq(impr1)
				predict impr0predSD, eq(impr0) stdp
				predict impr1predSD, eq(impr1) stdp
				su impr0pred
				local impr0pred = round(r(mean),0.001)
				su impr0predSD
				local impr0predSD = round(r(mean),0.001)
				su impr1pred
				local impr1pred = round(r(mean),0.001)
				su impr1predSD
				local impr1predSD = round(r(mean),0.001)
		restore
		test [impr0]comMain = [impr1]comMain
		local pDND_inMain = round(r(p), 0.001)
		test [impr0]comEduc = [impr1]comEduc
		local pDND_inEduc = round(r(p), 0.001)
		test [impr0]comMain = [impr0]comEduc
		local pMainEduc_inND = round(r(p), 0.001)
		test [impr1]comMain = [impr1]comEduc
		local pMainEduc_inD = round(r(p), 0.001)
		test [impr0]comMain - [impr1]comMain = [impr0]comEduc - [impr1]comEduc
		local diffInDiff = round(r(p), 0.001)
		
		outreg2 using "tables/tab3_4_cont1.tex", eqdrop(im0_2 im0_3 im0_4 im0_5 im0_6 im1_2 im1_3 im1_4 im1_5 im1_6) keep(com*) label dec(3)  ///
				addtext("Sample", "main", "FinComp1_2", "Yes", "Demogr.", "Yes", "Survey", "-", "Psychological", "-") ///
				addstat("impr0pred", `impr0pred', "impr0predSD", `impr0predSD', "impr1pred", `impr1pred', "impr1predSD", `impr1predSD', ///
					"pDND_inMain", `pDND_inMain', "pDND_inEduc", `pDND_inEduc', "pMainEduc_inND", `pMainEduc_inND', "pMainEduc_inD", `pMainEduc_inD', "diffInDiff", `diffInDiff') ///
				adec(3) tex(frag) 	
		
		
		sort id
		by id: egen impA0 = mean(improvementA0)
		by id: egen impA1 = mean(improvementA1)
				

		local controlsHere = "part12sophistic  `demo'   `survey' `psychCog'"
		xi: sureg 	(impA0 comMain comEduc `controlsHere') ///
				(impA1 comMain comEduc `controlsHere') ///
				if tag == 1

		preserve
				replace comMain = 0
				replace comEduc = 0
				xi: collapse impA* comMain comEduc `controlsHere'
				predict impA0pred, eq(impA0)
				predict impA1pred, eq(impA1)
				predict impA0predSD, eq(impA0) stdp
				predict impA1predSD, eq(impA1) stdp
				su impA0pred
				local impA0pred = round(r(mean),0.001)
				su impA0predSD
				local impA0predSD = round(r(mean),0.001)
				su impA1pred
				local impA1pred = round(r(mean),0.001)
				su impA1predSD
				local impA1predSD = round(r(mean),0.001)
		restore
		test [impA0]comMain = [impA1]comMain
		local pDND_inMain = round(r(p), 0.001)
		test [impA0]comEduc = [impA1]comEduc
		local pDND_inEduc = round(r(p), 0.001)
		test [impA0]comMain = [impA0]comEduc
		local pMainEduc_inND = round(r(p), 0.001)
		test [impA1]comMain = [impA1]comEduc
		local pMainEduc_inD = round(r(p), 0.001)
		test [impA0]comMain - [impA1]comMain = [impA0]comEduc - [impA1]comEduc
		local diffInDiff = round(r(p), 0.001)
		outreg2 using "tables/tab3_4_cont1.tex", eqdrop(im0_2 im0_3 im0_4 im0_5 im0_6 im1_2 im1_3 im1_4 im1_5 im1_6) keep(com*) label dec(3)  ///
				addtext("Sample", "main", "FinComp1_2", "Yes", "Demogr.", "Yes", "Survey", "-", "Psychological", "-") ///
				addstat("impr0pred", `impA0pred', "impr0predSD", `impA0predSD', "impr1pred", `impA1pred', "impr1predSD", `impA1predSD', ///
					"pDND_inMain", `pDND_inMain', "pDND_inEduc", `pDND_inEduc', "pMainEduc_inND", `pMainEduc_inND', "pMainEduc_inD", `pMainEduc_inD', "diffInDiff", `diffInDiff') ///
				adec(3) tex(frag) 	

	}

}
	
********* TABLE 4: Who benefits 					***************************
if 1 {

	clear
	use "data/mainDataCleaned.dta"
	
	
		sort pairId decisionNumber
		by pairId decisionNumber: egen maxComplex = max(deltaComplex) if pairId!=.
		by pairId decisionNumber: egen minComplex = min(deltaComplex) if pairId!=.	
		gen partnerDeltaComplex=.
		replace partnerDeltaComplex=maxComplex if deltaComplex==minComplex
		replace partnerDeltaComplex=minComplex if deltaComplex==maxComplex
	

		keep if receiver == 1
		keep if mplCheck == 1
		
		gen mimicryAbsDiffDelta=.
		replace mimicryAbsDiffDelta=absDiffDelta if part==1 | part==2
		replace mimicryAbsDiffDelta=absDiffDelta if part==3 & noComMain==1
		replace mimicryAbsDiffDelta=abs(partnerDeltaComplex-deltaSimple) if part==3 & ( comMain==1 | comEduc==1)
	
		gen mimicryAbsDiffDeltaBench=.
		replace mimicryAbsDiffDeltaBench=absD_0benchmark if part==1 | part==2
		replace mimicryAbsDiffDeltaBench=absD_0benchmark if part==3 & noComMain==1
		replace mimicryAbsDiffDeltaBench=MabsD_0benchmark if part==3 & ( comMain==1 | comEduc==1)
	
	
	
	
		drop partnerDeltaComplex maxComplex minComplex

		

		quietly {
			keep if stage23match ~= .
					
			capture: gen logHHinc = log(hhinc)
			capture: gen ageSq = age^2
			
			local keep_demoFirst = "male age ageSq ethnici nativel"
			local keep_demoSecond = "international  community"	// community is urban, suburban or rural
			local keep_cog = "cogAbility* mplCheck"	// variable knowledgeable is a coarsening of a continuous variable, and hence a suboptimal predictor
			local keep_financials = "logHHincPerCap cardown finLit part1sophistication part2FVsophistic part2sophistication finassistance cashadv cardroll"
			local keep_debrief = "heardBefore talk prepared followup"
			local keep_psych = "conformity bigFive_*" 
			local treatmentVars = "comEduc comMain noComMain noComNoAnn stage23match decisionKind"

			keep 	absDiffDelta absD_0bench  mimicryAbsDiffDelta mimicryAbsDiffDeltaBench main id comMain comEduc sdSimple  ///
					`keep_demoFirst' `keep_demoSecond' `keep_cog' `keep_financials' `keep_debrief' `keep_psych' `treatmentVars' ///
					international gpa com_part1soph* part1soph* part12soph* part122soph* *Partner partner* knowledgeable ///
					discussionTime finLitSum* gender partnerGender part1soph* deltaSimple deltaComplex
			
			order abs*
			
			reshape wide absDiffDelta absD_0benchmark mimicryAbsDiffDelta mimicryAbsDiffDeltaBench deltaSimple deltaComplex, i(id stage23match) j(decisionKind)
		
			gen improvement0 = absDiffDelta1 - absDiffDelta3 
			gen improvement1 = absDiffDelta1 - absDiffDelta2 

			gen impAlt0 = absD_0benchmark1 - absD_0benchmark3
			gen impAlt1 = absD_0benchmark1 - absD_0benchmark2
			
			gen improvementM0 = mimicryAbsDiffDelta1 - mimicryAbsDiffDelta3 
			gen improvementM1 = mimicryAbsDiffDelta1 - mimicryAbsDiffDelta2 

			gen impAltM0 = mimicryAbsDiffDeltaBench1 - mimicryAbsDiffDeltaBench3
			gen impAltM1 = mimicryAbsDiffDeltaBench1 - mimicryAbsDiffDeltaBench2
			
			gen changeSimple0 = deltaSimple1 - deltaSimple3 
			gen changeSimple1 = deltaSimple1 - deltaSimple2 

			gen changeComplex0 = deltaComplex1 - deltaComplex3 
			gen changeComplex1 = deltaComplex1 - deltaComplex2 
		



			
			// Explanation: 
			// 	The variable stage23match is 1 if the observation is from stage 2, 
			// 	2 if it is for stage3-Discussed, and 3 if it is for stage3-Not Discussed
			//	impAlt is the same thing, but taking preferences in the simple frame as 
			//	welfare-relevant benchmark
			
		
		}
		

		
		// Mentioned in main text:
		// level of financial competence
		su absDiffDelta1
		reg absDiffDelta1, cl(id)
		

		drop absDiffDelta1
		rename absDiffDelta2 absDiffDelta0
		rename absDiffDelta3 absDiffDelta1
		
		drop mimicryAbsDiffDelta1 mimicryAbsDiffDeltaBench1
		rename mimicryAbsDiffDelta2 mimicryAbsDiffDelta0
		rename mimicryAbsDiffDelta3 mimicryAbsDiffDelta1
		rename mimicryAbsDiffDeltaBench2 mimicryAbsDiffDeltaBench0
		rename mimicryAbsDiffDeltaBench3 mimicryAbsDiffDeltaBench1
					
		reshape long improvement impAlt improvementM impAltM absDiffDelta mimicryAbsDiffDelta mimicryAbsDiffDeltaBench changeSimple changeComplex, i(id stage23match) j(discussed)
		
		gen stage23discussed = 10 * discussed + stage23

		label var part1sophisti "FinComp Part 1"
		label var part2FVsophistic "FinComp Part 2FV"
		

	
	capture: gen com = comMain == 1 | comEduc == 1
	
	capture: gen com_part12sophM1 = com * part12sophM1
	capture: gen com_part12sophM2 = com * part12sophM2
	
	capture: gen com_part12sophQ1 = com * part12sophQ1
	capture: gen com_part12sophQ2 = com * part12sophQ2
	capture: gen com_part12sophQ3 = com * part12sophQ3
	capture: gen com_part12sophQ4 = com * part12sophQ4

	capture: gen sdSimple2 = sdSimple^2
				
	
	su part1sophRPartner, d
	gen part1sophRpartnerM1 = part1sophRPartner < r(p50)
	gen part1sophRpartnerM2 = part1sophRPartner >= r(p50) 
	// M1 are those who make good decisions, M2 those who make bad decisions
	
	
	su part122sophRPartner, d
	gen part122sophRpartnerM1 = part122sophRPartner < r(p50)
	gen part122sophRpartnerM2 = part122sophRPartner >= r(p50) 

	
	gen interactionM00 = part12sophM1 == 0	& part122sophRpartnerM1 == 0
	gen interactionM01 = part12sophM1 == 0	& part122sophRpartnerM1 == 1
	gen interactionM10 = part12sophM1 == 1	& part122sophRpartnerM1 == 0
	gen interactionM11 = part12sophM1 == 1	& part122sophRpartnerM1 == 1
					
					
					
					
					
					
				
	replace interactionM00 = 0 if com == 0
	replace interactionM01 = 0 if com == 0						
	replace interactionM10 = 0 if com == 0
	replace interactionM11 = 0 if com == 0		
	

	**********************************************************
	
	// What drives the effects, changes in simply or in complexly framed valuations? 
	local controlsHereSparse = " `demo' part12sophisti  "

	xi: reg changeSimple com_part12sophM*  part12sophM1 	i.stage23discussed	`controlsHereSparse' if discussed == 0 ,cl(id) 
	xi: reg changeComplex com_part12sophM*  part12sophM1 	i.stage23discussed	`controlsHereSparse' if discussed == 0 ,cl(id) 
	
	xi: reg changeSimple interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
	xi: reg changeComplex interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
	
	capture gen absChangeSimple = abs(changeSimple)
	capture gen absChangeComplex = abs(changeComplex)
	
	xi: reg absChangeSimple interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
	xi: reg absChangeComplex interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
	
	**********************************************************

	// Do better and worse subjects differ systematically w.r.t. time preferences?
	
	xi: reg deltaSimple1 interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
	test interactionM10 == interactionM11
	xi: reg deltaSimple1 com_part12sophM*  part12sophM1 	i.stage23discussed	`controlsHereSparse' if discussed == 0 ,cl(id) 


	**********************************************************
	
	
	
	gen discussionMinutes = discussionTime / 60
	
	local controlsHereSparse = " `demo' part12sophisti "
	
	rename improvement imp
	
	gen com_part1sophRpartnerM1 = com * part1sophRpartnerM1
	gen com_part1sophRpartnerM2 = com * part1sophRpartnerM2
	
	xi: reg imp interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' ,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse' 
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefits.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex replace	
	
	xi: reg imp interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse' if discussed==0
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefits.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Discussed", "No", "Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex 

	xi: reg imp interactionM* 	part12sophM1	i.stage23discussed  `controlsHereSparse' if discussed == 1, cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse' if discussed==1
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefits.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Discussed", "Yes", "Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex
		
		
		xi: reg improvementM interactionM* part12sophM1 i.stage23discusse `controlsHereSparse' if discussed==1,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse improvementM com_part12sophM1 com_part12sophM2  part12sophM1 interactionM*  i.stage23discusse `controlsHereSparse' if discussed==1
			predict confidence,
			predict confidenceSD, stdp
			su confidence
			local confidence = round(r(mean),0.001)
			su confidenceSD
			local confidenceSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefits.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Discussed", "Yes", "Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex
		

		xi: reg impAlt interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' ,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse' 
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefits.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex

	xi: reg impAlt interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse'  if discussed==0
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefits.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Discussed", "No", "Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex
			
		

	xi: reg impAlt interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==1 ,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse'  if discussed==1
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefits.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Discussed", "Yes", "Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex(frag)
		
		xi: reg impAltM interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==1 ,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse'  if discussed==1
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefits.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Discussed", "Yes", "Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex(frag)
		
		
	
	
								
}


***************************************************************************************		
********* Figures				 		***********************************************
***************************************************************************************	

********* FIGURES 1 Panels A - C							***************************
if 1 {
	clear
	use "data/mainDataCleaned.dta"
	
	
	keep if receiver == 1
	keep if mplCheck == 1
	
	replace absDiffDelta = . if simple == 1
	
	sort id
	by id: egen meanAbsDiff = mean(-absDiffDelta)
	by id: egen meanAbsDiffStage1 = mean(-absDiffDelta) if part==2
	
	by id: egen deltaComplexStage1=mean(deltaComplex) if part==2
	by id: egen deltaComplexStage2=mean(deltaComplex) if part==3
	by id: egen deltaSimpleStage1=mean(deltaSimple) if part==2
	by id: egen deltaSimpleStage2=mean(deltaSimple) if part==3
	
	// The following is reported as mean value of complexly framed valuations in the main text: 
	su deltaComplex if delay == 48
	su deltaComplex if delay == 72
	
	
	egen uniqueIDstage1=tag(id) if  deltaComplexStage1!=.
	egen uniqueIDstage2=tag(id) if  deltaComplexStage2!=.
		
	if 1 {	
		preserve
			local truncation = -1
			replace meanAbsDiffStage1 = `truncation' if meanAbsDiffStage1 < `truncation' & meanAbsDiffStage1 ~= .
			hist meanAbsDiffStage1 if uniqueIDstage1==1, ///
				bin(20) ///
				percent ///
				fcolor(ltblue) lcolor(white) lwidth(thin) ///
				bgcolor(white) graphregion(color(white)) ///
				xtitle("Deliberative Competence in Stage 1") ///
				ytitle("% Subjects") ///
				scale(1.3) aspect(0.4) ///
				ylabel(0(10)30) 
				// title("Financial Competence (if < 1) - All Receivers") ///
			graph export "graphs/distributionFinCompReceivers.pdf", replace
		restore
	}	
	noisily: su meanAbsDiffStage1 if uniqueIDstage1==1, d
	
	preserve 
	
		replace deltaComplexStage1 = 2 if deltaComplexStage1 > 2
		replace deltaComplexStage2 = 2 if deltaComplexStage2 > 2
		replace deltaSimpleStage1 = 2 if deltaSimpleStage1 > 2
		replace deltaSimpleStage2 = 2 if deltaSimpleStage2 > 2

	if 1{
		
	
		twoway (hist deltaComplexStage1 if uniqueIDstage1==1, percent lcolor(ltblue) fcolor(ltblue) lwidth(thin) start(0) width(.125)) ///
			   (hist deltaComplexStage2 if uniqueIDstage2==1, percent fcolor(none) lcolor(dknavy) start(0) width(.125)), ///
				legend(label(1 "Stage 1") label(2 "Stage 2") ring(0) col(1) pos(2)) ///
				xtitle("Mean Normalized Valuation in Complex Frame") ///
				ytitle("% Subjects") ///
				yscale(range(0 60)) ///
				ylabel(0(20)60) ///
				xscale(range(0 2)) /// 
				xlabel(0(0.5)2) ///
				bgcolor(white) graphregion(color(white)) ///
				scale(1.4) aspect(0.4) ///
				// title("Financial Competence (if < 1) - All Receivers") ///
		graph export "graphs/distributionComplexReceivers.pdf", replace
	}
	
	if 1{
		twoway (hist deltaSimpleStage1 if uniqueIDstage1==1, percent lcolor(ltblue) fcolor(ltblue) lwidth(thin) start(0) width(.125)) ///
			   (hist deltaSimpleStage2 if uniqueIDstage2==1, percent fcolor(none) lcolor(dknavy) start(0) width(.125)), ///
				legend(label(1 "Stage 1") label(2 "Stage 2")  ring(0) col(1) pos(2)) ///
				xtitle("Mean Normalized Valuation in Simple Frame") ///
				ytitle("% Subjects") ///
				yscale(range(0 60)) ///
				ylabel(0(20)60) ///
				xscale(range(0 2)) /// 
				xlabel(0(0.5)2) ///
				bgcolor(white) graphregion(color(white)) ///
				scale(1.4) aspect(0.4) ///
				// title("Financial Competence (if < 1) - All Receivers") ///
		graph export "graphs/distributionSimpleReceivers.pdf", replace
	}
	restore
}

********* FIGURE 2 Panel A: Main Effect of Communication
if 1 {
	clear
	use "data/mainDataCleaned.dta"


	keep if receiver == 1
	keep if mplCheck == 1
	keep if stage23match ~= .
				
		capture: gen logHHinc = log(hhinc)
		capture: gen logHHinc = log(hhinc)
		capture: gen ageSq = age^2
		
		local keep_demoFirst = "male age ageSq ethnici nativel"
		local keep_demoSecond = "international  community"	// community is urban, suburban or rural
		local keep_cog = "cogAbility* mplCheck"	// variable knowledgeable is a coarsening of a continuous variable, and hence a suboptimal predictor
		local keep_financials = "logHHincPerCap cardown finLit part1sophistication part2FVsophistic part2sophistication finassistance cashadv cardroll"
		local keep_debrief = "heardBefore talk prepared followup"
		local keep_psych = "conformity bigFive_*" 
		local treatmentVars = "comEduc comMain noComMain noComNoAnn stage23match decisionKind"

		keep 	absDiffDelta main id comMain comEduc sdSimple  ///
				`keep_demoFirst' `keep_demoSecond' `keep_cog' `keep_financials' `keep_debrief' `keep_psych' `treatmentVars' ///
				international gpa com_part1soph* part1soph* part12soph* part122soph* *Partner partner* knowledgeable ///
				discussionTime finLitSum* gender partnerGender part1soph* part2 part3 decisionNumber
		
	
	gen comMainPart2=comMain*part2
	gen comMainPart3=comMain*part3
	
	gen comEducPart2=comEduc*part2
	gen comEducPart3=comEduc*part3
	
	gen noComMainPart2=noComMain*part2
	gen noComMainPart3=noComMain*part3
	
	***Solitary Part 2
	xi: reg absDiffDelta  comMainPart2 comEducPart2 noComMainPart3  comMainPart3 comEducPart3 part12sophisti  `demo' `survey' `psychCog', cl(id) 

	preserve
	
	replace comMainPart2  = 0
	replace comEducPart2 = 0
	replace noComMainPart3  = 0
	replace comMainPart3 = 0
	replace comEducPart3  = 0

	xi: collapse absDiffDelta  comMainPart2 comEducPart2 noComMainPart3  comMainPart3 comEducPart3 part12sophisti `demo' `survey' `psychCog'
	predict contrLevel,
	predict contrLevelSD, stdp
	local m1=contrLevel
	local s1=contrLevelSD
	restore
	
	***Communication Main Part 2
	xi: reg absDiffDelta  noComMainPart2 comEducPart2 noComMainPart3  comMainPart3 comEducPart3 part12sophisti `demo' `survey' `psychCog', cl(id) 

	preserve
	
	replace noComMainPart2  = 0
	replace comEducPart2 = 0
	replace noComMainPart3  = 0
	replace comMainPart3 = 0
	replace comEducPart3  = 0

	xi: collapse absDiffDelta  noComMainPart2 comEducPart2 noComMainPart3  comMainPart3 comEducPart3 part12sophisti `demo' `survey' `psychCog'
	predict contrLevel,
	predict contrLevelSD, stdp
	local m2=contrLevel
	local s2=contrLevelSD
	restore
	
	***Communication Educ Part 2
	xi: reg absDiffDelta  noComMainPart2 comMainPart2 noComMainPart3  comMainPart3 comEducPart3 part12sophisti  `demo' `survey' `psychCog', cl(id) 
	/*
	lincom noComMainPart2-comMainPart2
	lincom noComMainPart3-comMainPart3
	lincom noComMainPart3-comMainPart3-noComMainPart2+comMainPart2
	*/
	preserve
	
	replace noComMainPart2  = 0
	replace comMainPart2 = 0
	replace noComMainPart3  = 0
	replace comMainPart3 = 0
	replace comEducPart3  = 0

	xi: collapse absDiffDelta  noComMainPart2 comMainPart2 noComMainPart3  comMainPart3 comEducPart3 part12sophisti `demo' `survey' `psychCog'
	predict contrLevel,
	predict contrLevelSD, stdp
	local m3=contrLevel
	local s3=contrLevelSD
	restore
	
	
	***Solitary Part 3
	xi: reg absDiffDelta  noComMainPart2 comMainPart2 comEducPart2 comMainPart3 comEducPart3 part12sophisti `demo' `survey' `psychCog', cl(id) 

	preserve
	
	replace noComMainPart2  = 0
	replace comMainPart2 = 0
	replace comEducPart2 = 0
	replace comMainPart3 = 0
	replace comEducPart3  = 0

	xi: collapse absDiffDelta  noComMainPart2 comMainPart2 comEducPart2 comMainPart3 comEducPart3 part12sophisti `demo' `survey' `psychCog'
	predict contrLevel,
	predict contrLevelSD, stdp
	local m4=contrLevel
	local s4=contrLevelSD
	restore
	
	***Communication Main Part 3
	xi: reg absDiffDelta  noComMainPart2 comMainPart2 comEducPart2 noComMainPart3 comEducPart3 part12sophisti `demo' `survey' `psychCog', cl(id) 

	preserve
	
	replace noComMainPart2  = 0
	replace comMainPart2 = 0
	replace comEducPart2 = 0
	replace noComMainPart3 = 0
	replace comEducPart3  = 0

	xi: collapse absDiffDelta  noComMainPart2 comMainPart2 comEducPart2 noComMainPart3 comEducPart3 part12sophisti `demo' `survey' `psychCog'
	predict contrLevel,
	predict contrLevelSD, stdp
	local m5=contrLevel
	local s5=contrLevelSD
	restore
	
	***Communication Educ Part 3
	xi: reg absDiffDelta  noComMainPart2 comMainPart2 comEducPart2 noComMainPart3 comMainPart3 part12sophisti `demo' `survey' `psychCog', cl(id) 

	preserve
	
	replace noComMainPart2  = 0
	replace comMainPart2 = 0
	replace comEducPart2 = 0
	replace noComMainPart3 = 0
	replace comMainPart3  = 0

	xi: collapse absDiffDelta  noComMainPart2 comMainPart2 comEducPart2 noComMainPart3 comMainPart3 part12sophisti `demo' `survey' `psychCog'
	predict contrLevel,
	predict contrLevelSD, stdp
	local m6=contrLevel
	local s6=contrLevelSD
	restore
		
	clear
	
	set obs 8
	gen mean = .
	gen lower = .
	gen upper = . 
	gen id = _n
	gen part3 = (id==4 | id == 5 | id == 6)
	gen control = (id == 1 | id == 4) 
	gen educ = (id == 3 | id == 6) 
	

forvalues i = 1 / 6 {
replace mean = -`m`i'' if id == `i'
replace lower = mean - 1.96 * `s`i'' if id == `i'
replace upper = mean + 1.96 * `s`i'' if id == `i'
}
	
gen zero = -.1
gen zero2 = -.095
local margin = .15
replace part3 = -`margin' if id == 7
replace part3 = 1 + `margin' if id == 8
local shift = -0.008
gen part3Shift  = part3 + `shift'
gen part3Shift2 = part3 - `shift'
local aspect = .9


tw 	(scatter mean part3 if control == 1, msize(vlarge) mcolor(navy)  msymbol(circle_hollow)) /// 
	(scatter mean part3 if educ == 0 & control == 0, msize(vlarge) mcolor(maroon)  msymbol(diamond)) ///
	(line mean part3 if control == 1, lwidth(1) lpattern(longdash) lcolor(navy) ) ///
	(line mean part3 if educ == 0 & control == 0, lwidth(1) lcolor(maroon) ) ///
	, ///
	xlabel(0 "Stage 1" 1 "Stage 2") xtitle(" ") ///
	legend(order(3 "Solitary" 4 "Communication")  ring(0) col(1) pos(11)) ///
	ytitle("Deliberative Competence") yscale(titlegap(*10)) ///
	bgcolor(white) graphregion(color(white))  ///
	ylabel(-.30(.05)-.15)  scale(*1.5) ///
	aspect(0.9)
graph export "graphs/fig2B.pdf", replace





}	

********* FIGURE 2 Panels B and C
if 1 {
	clear
	use "data/mainDataCleaned.dta"

	keep if receiver == 1
	keep if mplCheck == 1
	keep if stage23match ~= .
				
		capture: gen logHHinc = log(hhinc)
		capture: gen ageSq = age^2
		
		local keep_demoFirst = "male age ageSq ethnici nativel"
		local keep_demoSecond = "international  community"	// community is urban, suburban or rural
		local keep_cog = "cogAbility* mplCheck"	// variable knowledgeable is a coarsening of a continuous variable, and hence a suboptimal predictor
		local keep_financials = "logHHincPerCap cardown finLit part1sophistication part2FVsophistic part2sophistication finassistance cashadv cardroll"
		local keep_debrief = "heardBefore talk prepared followup"
		local keep_psych = "conformity bigFive_*" 
		local treatmentVars = "comEduc comMain noComMain noComNoAnn stage23match decisionKind"

		keep 	absDiffDelta main id comMain comEduc sdSimple  ///
				`keep_demoFirst' `keep_demoSecond' `keep_cog' `keep_financials' `keep_debrief' `keep_psych' `treatmentVars' ///
				international gpa com_part1soph* part1soph* part12soph* part122soph* *Partner partner* knowledgeable ///
				discussionTime finLitSum* gender partnerGender part1soph* part2 part3 discussed
								
		sort id decisionKind
		by id decisionKind: egen level = mean(absDiffDelta) 
		
		gen comMainPart2=comMain*part2
		gen comMainPart3ND=0
		replace comMainPart3ND=1 if comMain==1 & part3==1 & discussed==0
		gen comMainPart3D=0
		replace comMainPart3D=1 if comMain==1 & part3==1 & discussed==1
	
		gen comEducPart2=comEduc*part2
		gen comEducPart3ND=0
		replace comEducPart3ND=1 if comEduc==1 & part3==1 & discussed==0
		gen comEducPart3D=0
		replace comEducPart3D=1 if comEduc==1 & part3==1 & discussed==1
	
		gen noComMainPart2=noComMain*part2
		gen noComMainPart3ND=0
		replace noComMainPart3ND=1 if noComMain==1 & part3==1 & discussed==0
		gen noComMainPart3D=0
		replace noComMainPart3D=1 if noComMain==1 & part3==1 & discussed==1
		
		egen tagDND = tag(id decisionKind)
		local controlsHere = "i.stage23 part12sophistic `survey' `psychCog' `demo'  "
		
		//  
		
		*Solitary Part 2 Mean
		xi: reg level comMainPart2 comEducPart2 noComMainPart3ND comMainPart3ND comEducPart3ND noComMainPart3D comMainPart3D comEducPart3D `controlsHere' if tagDND == 1, vce(cluster id)
		
		preserve 
		replace comMainPart2=0
		replace comMainPart3ND=0
		replace comMainPart3D=0
		
		replace comEducPart2=0
		replace comEducPart3ND=0
		replace comEducPart3D=0
		
		
		replace noComMainPart3ND=0
		replace noComMainPart3D=0
		
		xi: collapse level comMainPart2 comEducPart2 noComMainPart3ND comMainPart3ND comEducPart3ND noComMainPart3D comMainPart3D comEducPart3D `controlsHere' if tagDND == 1
		predict levelPred
		predict levelPredSD, stdp
		su levelPred
		local m1=levelPred
		local s1=levelPredSD
		
		restore
		
		*Communication with Uneducated Part 2 Mean
		xi: reg level noComMainPart2 comEducPart2 noComMainPart3ND comMainPart3ND comEducPart3ND noComMainPart3D comMainPart3D comEducPart3D `controlsHere' if tagDND == 1, vce(cluster id)
			
		preserve 
		
		replace comMainPart3ND=0
		replace comMainPart3D=0
		
		replace comEducPart2=0
		replace comEducPart3ND=0
		replace comEducPart3D=0
		
		replace noComMainPart2=0
		replace noComMainPart3ND=0
		replace noComMainPart3D=0
		
		xi: collapse level noComMainPart2 comEducPart2 noComMainPart3ND comMainPart3ND comEducPart3ND noComMainPart3D comMainPart3D comEducPart3D `controlsHere' if tagDND == 1
		predict levelPred
		predict levelPredSD, stdp
		su levelPred
		local m2=levelPred
		local s2=levelPredSD
		restore
		
		*Communication with Educated Part 2 Mean
		xi: reg level noComMainPart2 comMainPart2 noComMainPart3ND comMainPart3ND comEducPart3ND noComMainPart3D comMainPart3D comEducPart3D `controlsHere' if tagDND == 1, vce(cluster id)
		/*
		lincom noComMainPart2-comMainPart2
		lincom noComMainPart3D-comMainPart3D
		lincom noComMainPart3ND-comMainPart3ND
		lincom noComMainPart3D-comMainPart3D-noComMainPart3ND+comMainPart3ND
		*/
		
		preserve 
		replace comMainPart2=0
		replace comMainPart3ND=0
		replace comMainPart3D=0
		
		
		replace comEducPart3ND=0
		replace comEducPart3D=0
		
		replace noComMainPart2=0
		replace noComMainPart3ND=0
		replace noComMainPart3D=0
		
		xi: collapse level noComMainPart2 comMainPart2 noComMainPart3ND comMainPart3ND comEducPart3ND noComMainPart3D comMainPart3D comEducPart3D `controlsHere' if tagDND == 1
		predict levelPred
		predict levelPredSD, stdp
		su levelPred
		local m3=levelPred
		local s3=levelPredSD
		restore
		
		*Solitary Part 3 Not Discussed Mean
		xi: reg level noComMainPart2 comMainPart2  comEducPart2 comMainPart3ND comEducPart3ND noComMainPart3D comMainPart3D comEducPart3D `controlsHere' if tagDND == 1, vce(cluster id)
		
		preserve 
		replace comMainPart2=0
		replace comMainPart3ND=0
		replace comMainPart3D=0
		
		replace comEducPart2=0
		replace comEducPart3ND=0
		replace comEducPart3D=0
		
		replace noComMainPart2=0

		replace noComMainPart3D=0
		
		xi: collapse level noComMainPart2 comMainPart2 comEducPart2 comMainPart3ND comEducPart3ND noComMainPart3D comMainPart3D comEducPart3D `controlsHere' if tagDND == 1
		predict levelPred
		predict levelPredSD, stdp
		su levelPred
		local m4=levelPred
		local s4=levelPredSD
		restore
		
		*Communication with Uneducated Part 3 Not Discussed Mean
		xi: reg level noComMainPart2 comMainPart2  comEducPart2 noComMainPart3ND comEducPart3ND noComMainPart3D comMainPart3D comEducPart3D `controlsHere' if tagDND == 1, vce(cluster id)
	
		preserve 
		replace comMainPart2=0
	
		replace comMainPart3D=0
		
		replace comEducPart2=0
		replace comEducPart3ND=0
		replace comEducPart3D=0
		
		replace noComMainPart2=0
		replace noComMainPart3ND=0
		replace noComMainPart3D=0
		
		xi: collapse level noComMainPart2 comMainPart2 comEducPart2 noComMainPart3ND comEducPart3ND noComMainPart3D comMainPart3D comEducPart3D `controlsHere' if tagDND == 1
		predict levelPred
		predict levelPredSD, stdp
		su levelPred
		local m5=levelPred
		local s5=levelPredSD
		restore
		
		*Communication with Educated Part 3 Not Discussed Mean
		xi: reg level noComMainPart2 comMainPart2  comEducPart2 noComMainPart3ND comMainPart3ND noComMainPart3D comMainPart3D comEducPart3D `controlsHere' if tagDND == 1, vce(cluster id)
	
		preserve 
		replace comMainPart2=0
		replace comMainPart3ND=0
		replace comMainPart3D=0
		
		replace comEducPart2=0
		
		replace comEducPart3D=0
		
		replace noComMainPart2=0
		replace noComMainPart3ND=0
		replace noComMainPart3D=0
		
		xi: collapse level noComMainPart2 comMainPart2 comEducPart2 noComMainPart3ND comMainPart3ND noComMainPart3D comMainPart3D comEducPart3D `controlsHere' if tagDND == 1
		predict levelPred
		predict levelPredSD, stdp
		su levelPred
		local m6=levelPred
		local s6=levelPredSD
		restore
		
		*Solitary Part 3 Discussed Mean
		xi: reg level noComMainPart2 comMainPart2  comEducPart2 noComMainPart3ND comMainPart3ND comEducPart3ND  comMainPart3D comEducPart3D `controlsHere' if tagDND == 1, vce(cluster id)
	
		preserve 
		replace comMainPart2=0
		replace comMainPart3ND=0
		replace comMainPart3D=0
		
		replace comEducPart2=0
		replace comEducPart3ND=0
		replace comEducPart3D=0
		
		replace noComMainPart2=0
		replace noComMainPart3ND=0
		
		xi: collapse level noComMainPart2 comMainPart2 comEducPart2 noComMainPart3ND comMainPart3ND comEducPart3ND  comMainPart3D comEducPart3D `controlsHere' if tagDND == 1
		predict levelPred
		predict levelPredSD, stdp
		su levelPred
		local m7=levelPred
		local s7=levelPredSD
		restore
		
		*Communication with Uneducated Part 3 Discussed Mean
		xi: reg level noComMainPart2 comMainPart2  comEducPart2 noComMainPart3ND comMainPart3ND comEducPart3ND  noComMainPart3D comEducPart3D `controlsHere' if tagDND == 1, vce(cluster id)
	
		preserve 
		replace comMainPart2=0
		replace comMainPart3ND=0
		
		
		replace comEducPart2=0
		replace comEducPart3ND=0
		replace comEducPart3D=0
		
		replace noComMainPart2=0
		replace noComMainPart3ND=0
		replace noComMainPart3D=0
		
		xi: collapse level noComMainPart2 comMainPart2 comEducPart2 noComMainPart3ND comMainPart3ND comEducPart3ND  noComMainPart3D comEducPart3D `controlsHere' if tagDND == 1
		predict levelPred
		predict levelPredSD, stdp
		su levelPred
		local m8=levelPred
		local s8=levelPredSD
		restore
		
		*Communication with Educated Part 3 Discussed Mean
		xi: reg level noComMainPart2 comMainPart2  comEducPart2 noComMainPart3ND comMainPart3ND comEducPart3ND  noComMainPart3D comMainPart3D `controlsHere' if tagDND == 1, vce(cluster id)
		
		preserve 
		replace comMainPart2=0
		replace comMainPart3ND=0
		replace comMainPart3D=0
		
		replace comEducPart2=0
		replace comEducPart3ND=0
		
		
		replace noComMainPart2=0
		replace noComMainPart3ND=0
		replace noComMainPart3D=0
		
		xi: collapse level noComMainPart2 comMainPart2 comEducPart2 noComMainPart3ND comMainPart3ND comEducPart3ND  noComMainPart3D comMainPart3D `controlsHere' if tagDND == 1
		predict levelPred
		predict levelPredSD, stdp
		su levelPred
		local m9=levelPred
		local s9=levelPredSD
		restore
		
			
	clear
	set obs 11
		gen mean = .
		gen lower = .
		gen upper = . 
		gen id = _n
		gen part3 = (id>3)
		gen discussed= (id==1 | id==2 | id==3 | id==7 |id==8 | id==9)
		gen ndiscussed= (id==1 | id==2 | id==3 | id==4 |id==5 | id==6)
		gen control = (id == 1 | id==4| id == 7) 
		gen educ = (id == 3 | id == 6 | id==9) 
		
		
	forvalues i = 1 / 9 {
	replace mean = -`m`i'' if id == `i'
	replace lower = mean - 1.96 * `s`i'' if id == `i'
	replace upper = mean + 1.96 * `s`i'' if id == `i'
	}

		
	gen zero = -.1
	gen zero2 = -.095
	local margin = .15
	replace part3 = -`margin' if id == 10
	replace part3 = 1 + `margin' if id == 11
	local shift = -0.008
	gen part3Shift  = part3 + `shift'
	gen part3Shift2 = part3 - `shift'
	local aspect = .9


	

	// full
		
	tw (scatter mean part3 if control == 1 & discussed==1, msize(vlarge) mcolor(navy)  msymbol(circle_hollow)) /// 
		(scatter mean part3 if educ == 0 & control == 0 & discussed==1, msize(vlarge) mcolor(maroon)  msymbol(diamond)) ///
		(line mean part3 if control == 1 & discussed==1, lwidth(1) lpattern(longdash) lcolor(navy) ) ///
		(line mean part3 if educ == 0 & control == 0 & discussed==1, lwidth(1) lcolor(maroon) ) ///
		, ///
		xlabel(0 "Stage 1" 1 "Stage 2") xtitle(" ") ///
		xscale(range(-.15 1.15)) ///
		legend(order(3 "Solitary" 4 "Communication")  ring(0) col(1) pos(11))  ///
	    ytitle("Deliberative Competence") ///
		bgcolor(white) graphregion(color(white)) ylabel(-.30(.05)-.15) scale(*1.5)  aspect(`aspect') yscale(titlegap(*10))
		graph export "graphs/fig2B.pdf", replace

		
		
	tw (scatter mean part3 if control == 1 & ndiscussed==1, msize(vlarge) mcolor(navy)  msymbol(circle_hollow)) /// 
		(scatter mean part3 if educ == 0 & control == 0 & ndiscussed==1, msize(vlarge) mcolor(maroon)  msymbol(diamond)) ///
		(line mean part3 if control == 1 & ndiscussed==1, lwidth(1) lpattern(longdash) lcolor(navy) ) ///
		(line mean part3 if educ == 0 & control == 0 & ndiscussed==1, lwidth(1) lcolor(maroon) ) ///
		, ///
		xlabel(0 "Stage 1" 1 "Stage 2") xtitle(" ") ///
		xscale(range(-.15 1.15)) ///
		legend(order(3 "Solitary" 4 "Communication")  ring(0) col(1) pos(11))  ///
	    ytitle("Deliberative Competence") ///
		bgcolor(white) graphregion(color(white)) ylabel(-.30(.05)-.15) scale(*1.5)  aspect(`aspect') yscale(titlegap(*10))
		graph export "graphs/fig2C.pdf", replace

	

}
	
********* FIGURE 2 Panels D and E: Sender better / worse half
if 1 {
	// get data etc.
	if 1 {
		clear
		use "data/mainDataCleaned.dta"

		keep if receiver == 1
		keep if mplCheck == 1
		// keep if main == 1

		quietly {
			keep if stage23match ~= .
					
			capture: gen logHHinc = log(hhinc)
			capture: gen ageSq = age^2
			
			local keep_demoFirst = "male age ageSq ethnici nativel"
			local keep_demoSecond = "international  community"	// community is urban, suburban or rural
			local keep_cog = "cogAbility* mplCheck"	// variable knowledgeable is a coarsening of a continuous variable, and hence a suboptimal predictor
			local keep_financials = "logHHincPerCap cardown finLit part1sophistication part2FVsophistic part2sophistication finassistance cashadv cardroll"
			local keep_debrief = "heardBefore talk prepared followup"
			local keep_psych = "conformity bigFive_*" 
			local treatmentVars = "comEduc comMain noComMain noComNoAnn stage23match decisionKind"

			keep 	absDiffDelta main id comMain comEduc sdSimple  ///
					`keep_demoFirst' `keep_demoSecond' `keep_cog' `keep_financials' `keep_debrief' `keep_psych' `treatmentVars' ///
					international gpa com_part1soph* part1soph* part12soph* part122soph* *Partner partner* knowledgeable ///
					discussionTime finLitSum* gender partnerGender part1soph*
			
			reshape wide absDiffDelta, i(id stage23match) j(decisionKind)
		
			gen improvement0 = absDiffDelta1 - absDiffDelta3 
			gen improvement1 = absDiffDelta1 - absDiffDelta2 

			// Explanation: 
			// 	The variable stage23match is 1 if the observation is from stage 2, 
			// 	2 if it is for stage3-nonDiscussed, and 3 if it is for stage3-discussed
			
		}		
		

		rename absDiffDelta1 levelStage2
		rename absDiffDelta2 absDiffDelta0
		rename absDiffDelta3 absDiffDelta1
					
		reshape long improvement absDiffDelta, i(id stage23match) j(discussed)
		
		gen stage23discussed = 10 * discussed + stage23
		
		
		
		capture: gen com = comMain == 1 | comEduc == 1
		
		capture: gen com_part12sophM1 = com * part12sophM1
		capture: gen com_part12sophM2 = com * part12sophM2
		
		capture: gen com_part12sophQ1 = com * part12sophQ1
		capture: gen com_part12sophQ2 = com * part12sophQ2
		capture: gen com_part12sophQ3 = com * part12sophQ3
		capture: gen com_part12sophQ4 = com * part12sophQ4

		capture: gen sdSimple2 = sdSimple^2
					
		
		su part1sophRPartner, d
		gen part1sophRpartnerM1 = part1sophRPartner < r(p50)
		gen part1sophRpartnerM2 = part1sophRPartner >= r(p50) 
		// M1 are those who make good decisions, M2 those who make bad decisions
		
		
		su part122sophRPartner, d
		gen part122sophRpartnerM1 = part122sophRPartner < r(p50)
		gen part122sophRpartnerM2 = part122sophRPartner >= r(p50) 

		
		gen interactionM00 = part12sophM1 == 0	& part122sophRpartnerM1 == 0
		gen interactionM01 = part12sophM1 == 0	& part122sophRpartnerM1 == 1
		gen interactionM10 = part12sophM1 == 1	& part122sophRpartnerM1 == 0
		gen interactionM11 = part12sophM1 == 1	& part122sophRpartnerM1 == 1
						

						
						
						
						
		replace interactionM00 = 0 if com == 0
		replace interactionM01 = 0 if com == 0						
		replace interactionM10 = 0 if com == 0
		replace interactionM11 = 0 if com == 0		
		
		
		gen discussionMinutes = discussionTime / 60
		
		local controlsHereSparse = " `demo' part12sophisti  "
		
		rename improvement imp
		
		gen com_part1sophRpartnerM1 = com * part1sophRpartnerM1
		gen com_part1sophRpartnerM2 = com * part1sophRpartnerM2

	}
	
	
	

	// get estimates
	if 1 {

		local controlsHereSparse = " `demo'  "

		// from paper
		xi: reg imp interactionM* 	part12sophM1 i.stage23discussed	part12sophisti `controlsHereSparse' if discussed==0 ,  cl(id) 


		
		xi: reg3 ///
			(imp interactionM* 	part12sophM1	i.stage23discussed part12sophisti `controlsHereSparse') ///
			(levelStage2 interactionM* 	part12sophM1 i.stage23discussed) ///
			if 1, ols 
			
		lincom interactionM01 - interactionM00	
		lincom interactionM11 - interactionM10	
			
	
			
			if part12sophM1 == 1 {
				su part12sophisti if part12sophM1 == 1
				replace part12sophisti = r(mean)
			}
			else {
				su part12sophisti if part12sophM1 == 0
				replace part12sophisti = r(mean)
			}
						

						
						
						
						
						
						
						
						
						
						
					
		preserve
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0			
			replace part12sophM1 = 0
			
			if 1 {
				su part12sophisti
				if part12sophM1 == 1 {
					replace part12sophisti = r(min)
				}
				else {
					replace part12sophisti = r(max)
				}

				xi: collapse interactionM*  i.stage23discussed part12sophisti `controlsHereSparse', by(part12sophM1)

				predict levelStage2pred, eq(levelStage2)
				predict impPred, eq(imp)
				gen levelStage3pred = levelStage2pred - impPred
			}
			
			su levelStage2pred 
			local m2 = r(mean)
			su levelStage3pred
			local m4 = r(mean)
		restore
		
		// Control, R		1, 3
		preserve
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0			
			replace part12sophM1 = 1
			
			if 1 {
				su part12sophisti
				if part12sophM1 == 1 {
					replace part12sophisti = r(min)
				}
				else {
					replace part12sophisti = r(max)
				}

				xi: collapse interactionM*  i.stage23discussed part12sophisti `controlsHereSparse', by(part12sophM1)

				predict levelStage2pred, eq(levelStage2)
				predict impPred, eq(imp)
				gen levelStage3pred = levelStage2pred - impPred
			}
			
			su levelStage2pred 
			local m1 = r(mean)
			su levelStage3pred
			local m3 = r(mean)
		restore
		
		// Treatment, rs	5, 9
		preserve
			replace interactionM00 = 1
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0			
			replace part12sophM1 = 0
			
			if 1 {
				su part12sophisti
				if part12sophM1 == 1 {
					replace part12sophisti = r(min)
				}
				else {
					replace part12sophisti = r(max)
				}

				xi: collapse interactionM*  i.stage23discussed part12sophisti `controlsHereSparse', by(part12sophM1)

				predict levelStage2pred, eq(levelStage2)
				predict impPred, eq(imp)
				gen levelStage3pred = levelStage2pred - impPred
			}
			
			su levelStage2pred 
			local m5 = r(mean)
			su levelStage3pred
			local m9 = r(mean)
		restore
		
		// Treatment, rS	6, 10
		preserve
			replace interactionM00 = 0
			replace interactionM01 = 1
			replace interactionM10 = 0
			replace interactionM11 = 0			
			replace part12sophM1 = 0
			
			if 1 {
				su part12sophisti
				if part12sophM1 == 1 {
					replace part12sophisti = r(min)
				}
				else {
					replace part12sophisti = r(max)
				}

				xi: collapse interactionM*  i.stage23discussed part12sophisti `controlsHereSparse', by(part12sophM1)

				predict levelStage2pred, eq(levelStage2)
				predict impPred, eq(imp)
				gen levelStage3pred = levelStage2pred - impPred
			}
			
			su levelStage2pred 
			local m6 = r(mean)
			su levelStage3pred
			local m10 = r(mean)
		restore
		
		// Treatment, Rs	7, 11
		preserve
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 1
			replace interactionM11 = 0			
			replace part12sophM1 = 1
			
			if 1 {
				su part12sophisti
				if part12sophM1 == 1 {
					replace part12sophisti = r(min)
				}
				else {
					replace part12sophisti = r(max)
				}

				xi: collapse interactionM*  i.stage23discussed part12sophisti `controlsHereSparse', by(part12sophM1)

				predict levelStage2pred, eq(levelStage2)
				predict impPred, eq(imp)
				gen levelStage3pred = levelStage2pred - impPred
			}
			
			su levelStage2pred 
			local m7 = r(mean)
			su levelStage3pred
			local m11 = r(mean)
		restore
		
		// Treatment, RS	8, 12
		preserve
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 1			
			replace part12sophM1 = 1
			
			if 1 {
				su part12sophisti
				if part12sophM1 == 1 {
					replace part12sophisti = r(min)
				}
				else {
					replace part12sophisti = r(max)
				}

				xi: collapse interactionM*  i.stage23discussed part12sophisti `controlsHereSparse', by(part12sophM1)

				predict levelStage2pred, eq(levelStage2)
				predict impPred, eq(imp)
				gen levelStage3pred = levelStage2pred - impPred
			}
			
			su levelStage2pred 
			local m8 = r(mean)
			su levelStage3pred
			local m12 = r(mean)
		restore
	}	
		
	clear
		
		set obs 14
		gen mean = .
		gen lower = .
		gen upper = . 
		gen id = _n
		gen part3 = (id==3 | id == 4 | id == 9 | id==10 | id==11 | id==12)
		gen better= (id==1 | id == 3 | id == 7 | id==8 | id==11  | id==12)
		gen control = (id <5) 
		gen senderBetter= (id==6 | id ==8  | id ==10  | id==12 )
		
	forvalues i = 1 / 12 {
		replace mean = -`m`i'' if id == `i'
	}
		
		
	gen zero = -.15
	gen zero2= -.145
	local margin = .15
	replace part3 = -`margin' if id == 13
	replace part3 = 1 + `margin' if id == 14
	local shift = -0.008
	gen part3Shift  = part3 + `shift'
	gen part3Shift2 = part3 - `shift'
	local aspect = .9

	local yrange = "-0.45(0.1)-0.05"
	*local aspect = 1.4
	
	// Full	
	tw (scatter mean part3 if control == 1 & better==1, msize(vlarge) mcolor(gs6)  msymbol(circle_hollow) color(gs6)) /// 
		(scatter mean part3 if control == 0 &  better==1 & senderBetter==1, msize(vlarge) mcolor(dkgreen)  msymbol(diamond)) ///
		(scatter mean part3 if control == 0 &  better==1 & senderBetter==0, msize(vlarge) mcolor(dkorange)) /// 
		(line mean part3 if control == 1 & better==1, lwidth(0.3) lpattern(shortdash) lcolor(gs6) ) ///
		(line mean part3 if control == 0 &  better==1 & senderBetter==1, lpattern(dash_dot) lwidth(1) lcolor(dkgreen) ) ///
		(line mean part3 if control == 0 &  better==1 & senderBetter==0, lpattern(dot)  lwidth(1) lcolor(dkorange)) ///
		(line zero part3 if part3 < 0) ///
		(line zero2 part3 if part3>0, lcolor(white)) ///
		, ///
		aspect(`aspect') ///
		xlabel(0 "Stage 1" 1 "Stage 2") xtitle(" ") ///
		legend(order(5 "Sender Better Half" 6 "Sender Worse Half" 4 "Solitary" ) ring(0) col(1) pos(7))  ///
		ytitle("Receiver's Deliberative Competence") ///
		bgcolor(white) graphregion(color(white)) ylabel(`yrange')  scale(*1.5) yscale(titlegap(*10))
		graph export "graphs/fig2D.pdf", replace	

	tw (scatter mean part3 if control == 1 & better==0, msize(vlarge) mcolor(gs6)  msymbol(circle_hollow)  lcolor(gs6)) /// 
		(scatter mean part3 if control == 0 &  better==0 & senderBetter==1, msize(vlarge) mcolor(dkgreen)  msymbol(diamond)) ///
		(scatter mean part3 if control == 0 &  better==0 & senderBetter==0, msize(vlarge) mcolor(dkorange)) /// 
		(line mean part3 if control == 1 & better==0,lwidth(0.3) lpattern(shortdash) lcolor(gs6) ) ///
		(line mean part3 if control == 0 &  better==0 & senderBetter==1, lpattern(dash_dot) lwidth(1) lcolor(dkgreen) ) ///
		(line mean part3 if control == 0 &  better==0 & senderBetter==0, lpattern(dot) lwidth(1) lcolor(dkorange)) ///
		(line zero part3 if part3 < 0) ///
		(line zero2 part3 if part3>0, lcolor(white)) ///
		, ///
		aspect(`aspect') ///		
		xlabel(0 "Stage 1" 1 "Stage 2") xtitle(" ") ///
	    legend(order(5 "Sender Better Half" 6 "Sender Worse Half" 4 "Solitary" ) ring(0) col(1) pos(11))  ///
		ytitle("Receiver's Deliberative Competence") ///
		bgcolor(white) graphregion(color(white)) ylabel(`yrange') scale(*1.5) yscale(titlegap(*10))
		graph export "graphs/fig2E.pdf", replace	
	


			
		
}

	

	
***************************************************************************************
*********	APPENDIX										***************************
***************************************************************************************

********* Table B.1: Summary statistics						***************************
if 1 {

	clear
	use "data/mainDataCleaned.dta"

	keep if receiver == 1
	
	
	reg com `controls', cl(id)
	
	// make dummies 
	xi: reg com `demo' `survey' `psychCog'

	ds 
	local allVars = r(varlist)
	
	di "`allVars'"
	
	rename bigFive_consc bigFiveConsc
	rename bigFive_agree bigFiveAgree
	rename bigFive_neuro bigFiveNeuro
	rename bigFive_open  bigFiveOpen 
	rename bigFive_extra bigFiveExtra
	
	local rand_demoFirst = "male age ageSq  nativel "
	local rand_cog = " mplCheck"	// variable knowledgeable is a coarsening of a continuous variable, and hence a suboptimal predictor
	local rand_financials = "logHHincPerCap part1sophistication finassistance "
	local rand_psych = "cogAbility conformity bigFiveConsc bigFiveAgree bigFiveNeuro bigFiveOpen  bigFiveExtra " 
	local rand_categorical = "_Iethnicity_2 _Iethnicity_3 _Iethnicity_4 _Iethnicity_5 _Iethnicity_6 _Iinternati_1 _Iinternati_2 _Icommunity_2 _Icommunity_3 _Icardown_1 _IfinLit_1 _Icashadvan_2 _Icashadvan_3 _Icardroll_2 _Icardroll_3 _Icardroll_4 _Icardroll_5 _Icardroll_6 _Icardroll_7 _IheardBefo_2 _IheardBefo_3 _Italk_1 _Italk_3 _Iprepared_1 _Iprepared_3 _Ifollowup_1 _Ifollowup_3"

	local randomCheck = "`rand_demoFirst' `rand_cog' `rand_financials' `rand_psych' `rand_categorical'"
	
	replace nativelang = 0 if nativelang == 2
	
	local numTests = 0
	local numSig10 = 0
	local numSig5 = 0
	postfile demo str60 varName float Control TreatmentE TreatmentN pPairCE pPairCN pPairEN pJoint str2 sigCE str2 sigCN str2 sigEN str2 sig str2 command using "data/demographics.dta", replace
		foreach var in `randomCheck' {
			reg `var' comEduc comMain if tagId == 1
			local control = round(_b[_cons], 0.001)
			local treatmentE = round(_b[_cons] + _b[comEduc], 0.001)
			local treatmentN = round(_b[_cons] + _b[comMain], 0.001)
			test _b[comE] == _b[comMain] == 0
			local pJoint = round(r(p), 0.001)
			local sig = " "
			local sigCN = " "
			local sigEN = " "
			local sigCE = " "
			if `pJoint' < 0.1 {
				local sig = "*"
				local numSig10 = `numSig10' + 1
			}
			if `pJoint' < 0.05 {
				local sig = "**"
				local numSig5 = `numSig5' + 1
			}
			test _b[comEduc] == 0
			local pPairCE = round(r(p), 0.001)
			if `pPairCE' < 0.1 {
				local sigCE = "*"
			}
			if `pPairCE' < 0.05 {
				local sigCE = "**"
			}
			test _b[comMain] == 0
			local pPairCN = round(r(p), 0.001)
			if `pPairCN' < 0.1 {
				local sigCN = "*"
			}
			if `pPairCN' < 0.05 {
				local sigCN = "**"
			}
			test _b[comEduc] == _b[comMain]
			local pPairEN = round(r(p), 0.001)
			if `pPairEN' < 0.1 {
				local sigEN = "*"
			}
			if `pPairEN' < 0.05 {
				local sigEN = "**"
			}
			
			local numTests = `numTests' + 1	
			local var = subinstr("`var'", "_", "",.) 
			post demo ("`var'") (`control') (`treatmentE') (`treatmentN') (`pPairCE') (`pPairCN') (`pPairEN') (`pJoint') ("`sigCE'") ("`sigCN'") ("`sigEN'") ("`sig'") ("\\")
		}
	postclose demo 
	
	noisily: di `numTests'
	noisily: di `numSig10'
	noisily: di `numSig5'
	
	preserve 
		clear
		use "data/demographics.dta"
		outsheet using "tables/demographics.tex", delimiter("&") nonames replace
	restore
	
	
	
	clear
	use "data/mainDataCleaned.dta"

	// keep if receiver == 1
	keep if mplCheck == 1
	
	replace absDiffDelta = . if simple == 1
	
	sort id
	by id: egen meanAbsDiff = mean(-absDiffDelta)
		

	noisily: su meanAbsDiff, d
			
}


********* Table B.9: Direct effect of education				***************************
if 1 {

	clear
	use "data/mainDataCleaned.dta"	 
	
	sort pairId
	by pairId: egen maxMplCheck = max(mplCheck) if pairId!=.
	by pairId: egen minMplCheck = min(mplCheck) if pairId!=.
	gen partnerMplCheck=.
	replace partnerMplCheck = minMplCheck if mplCheck == maxMplCheck
	replace partnerMplCheck = maxMplCheck if mplCheck == minMplCheck
	
	keep if mplCheck == 1 & partnerMplCheck==1
	keep if sender == 1
	

	// no noCom control subjects included, so no need for demo controls
	reg absDiffDelta treatment part1sophistication if part==2, vce(cluster id) 

	// within subjects analysis of FV-questions
	
	gen diffWithin = part2FVsoph - part1sophisti
	reg diffWithin treatment, cluster(id)




	label var part1sophistication "FinComp Part 1"
	label var treatment "Education"
	
	replace absDiffDelta=-absDiffDelta
	
	reg absDiffDelta treatment if part==2, vce(cluster id) 
		local numSubj = e(N_clust)
		preserve 
			replace treatment = 0
			collapse absDiffDelta treatment 
			predict level
			predict levelSD, stdp
			su level
			local level = round(r(mean),0.001)
			su levelSD
			local levelSD = round(r(mean),0.001)
		restore
		preserve 
			replace treatment = 1
			collapse absDiffDelta treatment 
			predict level
			predict levelSD, stdp
			su level
			local levelT = round(r(mean),0.001)
			su levelSD
			local levelTSD = round(r(mean),0.001)
		restore
		outreg2 using "tables/education1.tex",  keep(treatment part1sophistication) label dec(3)  ///
			addstat("#Subj", `numSubj', "Level in Control", `level', "SD level", `levelSD', "Level in T", `levelT', "SD level T", `levelTSD') ///
			addtext("Sample", "Senders", "Demogr.", "-", "Survey", "-", "Psychological", "-") ///
			tex replace	
	
	reg absDiffDelta treatment part1sophistication if part==2, vce(cluster id) 
		local numSubj = e(N_clust)
		preserve 
			replace treatment = 0
			collapse absDiffDelta treatment part1sophistication
			predict level
			predict levelSD, stdp
			su level
			local level = round(r(mean),0.001)
			su levelSD
			local levelSD = round(r(mean),0.001)
		restore
		preserve 
			replace treatment = 1
			collapse absDiffDelta treatment part1sophistication
			predict level
			predict levelSD, stdp
			su level
			local levelT = round(r(mean),0.001)
			su levelSD
			local levelTSD = round(r(mean),0.001)
		restore
		outreg2 using "tables/education1.tex",  keep(treatment part1sophistication) label dec(3)  ///
			addstat("#Subj", `numSubj', "Level in Control", `level', "SD level", `levelSD', "Level in T", `levelT', "SD level T", `levelTSD') ///
			addtext("Sample", "Senders", "Demogr.", "-", "Survey", "-", "Psychological", "-") ///
			tex 
	xi: reg absDiffDelta treatment part1sophistication `demo' if part == 2, vce(cluster id) 
		local numSubj = e(N_clust)
		preserve 
			replace treatment = 0
			xi, noomit: collapse absDiffDelta treatment part1sophistication `demo'
			predict level
			predict levelSD, stdp
			su level
			local level = round(r(mean),0.001)
			su levelSD
			local levelSD = round(r(mean),0.001)
		restore
		preserve 
			replace treatment = 1
			xi, noomit: collapse absDiffDelta treatment part1sophistication `demo'
			predict level
			predict levelSD, stdp
			su level
			local levelT = round(r(mean),0.001)
			su levelSD
			local levelTSD = round(r(mean),0.001)
		restore
		outreg2 using "tables/education1.tex",   keep(treatment part1sophistication)  label dec(3)  ///
			addstat("#Subj", `numSubj', "Level in Control", `level', "SD level", `levelSD', "Level in T", `levelT', "SD level T", `levelTSD') ///
			addtext("Sample", "Senders", "Demogr.", "Yes", "Survey", "-", "Psychological", "-") ///
			tex 		
		
	xi: reg absDiffDelta treatment part1sophistication `demo' `survey' `psychCog' if part==2, vce(cluster id) 
		local numSubj = e(N_clust)
		preserve 
			replace treatment = 0
			xi: collapse absDiffDelta treatment part1sophistication `demo' `survey' `psychCog'
			predict level,
			predict levelSD, stdp
			su level
			local level = round(r(mean),0.001)
			su levelSD
			local levelSD = round(r(mean),0.001)
		restore
		preserve 
			replace treatment = 1
			xi: collapse absDiffDelta treatment part1sophistication `demo' `survey' `psychCog'
			predict level
			predict levelSD, stdp
			su level
			local levelT = round(r(mean),0.001)
			su levelSD
			local levelTSD = round(r(mean),0.001)
		restore
		outreg2 using "tables/education1.tex",  keep(treatment part1sophistication) label dec(3)  ///
			addstat("#Subj", `numSubj', "Level in Control", `level', "SD level", `levelSD', "Level in T", `levelT', "SD level T", `levelTSD') ///
			addtext("Sample", "Senders", "Demogr.", "Yes", "Survey", "Yes", "Psychological", "Yes") ///
			tex(frag)	
			
}
			
********* Table B.4: Replication of Table 5, without controls		 ******************
if 1 {

	clear
	use "data/mainDataCleaned.dta"
	
	
		sort pairId decisionNumber
		by pairId decisionNumber: egen maxComplex = max(deltaComplex) if pairId!=.
		by pairId decisionNumber: egen minComplex = min(deltaComplex) if pairId!=.	
		gen partnerDeltaComplex=.
		replace partnerDeltaComplex=maxComplex if deltaComplex==minComplex
		replace partnerDeltaComplex=minComplex if deltaComplex==maxComplex
	

		keep if receiver == 1
		keep if mplCheck == 1
		
		gen mimicryAbsDiffDelta=.
		replace mimicryAbsDiffDelta=absDiffDelta if part==1 | part==2
		replace mimicryAbsDiffDelta=absDiffDelta if part==3 & noComMain==1
		replace mimicryAbsDiffDelta=abs(partnerDeltaComplex-deltaSimple) if part==3 & ( comMain==1 | comEduc==1)
	
		gen mimicryAbsDiffDeltaBench=.
		replace mimicryAbsDiffDeltaBench=absD_0benchmark if part==1 | part==2
		replace mimicryAbsDiffDeltaBench=absD_0benchmark if part==3 & noComMain==1
		replace mimicryAbsDiffDeltaBench=MabsD_0benchmark if part==3 & ( comMain==1 | comEduc==1)
	
	
	
	
		drop partnerDeltaComplex maxComplex minComplex

		

		quietly {
			keep if stage23match ~= .
					
			capture: gen logHHinc = log(hhinc)
			capture: gen ageSq = age^2
			
			local keep_demoFirst = "male age ageSq ethnici nativel"
			local keep_demoSecond = "international  community"	// community is urban, suburban or rural
			local keep_cog = "cogAbility* mplCheck"	// variable knowledgeable is a coarsening of a continuous variable, and hence a suboptimal predictor
			local keep_financials = "logHHincPerCap cardown finLit part1sophistication part2FVsophistic part2sophistication finassistance cashadv cardroll"
			local keep_debrief = "heardBefore talk prepared followup"
			local keep_psych = "conformity bigFive_*" 
			local treatmentVars = "comEduc comMain noComMain noComNoAnn stage23match decisionKind"

			keep 	absDiffDelta absD_0bench  mimicryAbsDiffDelta mimicryAbsDiffDeltaBench main id comMain comEduc sdSimple  ///
					`keep_demoFirst' `keep_demoSecond' `keep_cog' `keep_financials' `keep_debrief' `keep_psych' `treatmentVars' ///
					international gpa com_part1soph* part1soph* part12soph* part122soph* *Partner partner* knowledgeable ///
					discussionTime finLitSum* gender partnerGender part1soph* deltaSimple deltaComplex
			
			order abs*
			
			reshape wide absDiffDelta absD_0benchmark mimicryAbsDiffDelta mimicryAbsDiffDeltaBench deltaSimple deltaComplex, i(id stage23match) j(decisionKind)
		
			gen improvement0 = absDiffDelta1 - absDiffDelta3 
			gen improvement1 = absDiffDelta1 - absDiffDelta2 

			gen impAlt0 = absD_0benchmark1 - absD_0benchmark3
			gen impAlt1 = absD_0benchmark1 - absD_0benchmark2
			
			gen improvementM0 = mimicryAbsDiffDelta1 - mimicryAbsDiffDelta3 
			gen improvementM1 = mimicryAbsDiffDelta1 - mimicryAbsDiffDelta2 

			gen impAltM0 = mimicryAbsDiffDeltaBench1 - mimicryAbsDiffDeltaBench3
			gen impAltM1 = mimicryAbsDiffDeltaBench1 - mimicryAbsDiffDeltaBench2
			
			gen changeSimple0 = deltaSimple1 - deltaSimple3 
			gen changeSimple1 = deltaSimple1 - deltaSimple2 

			gen changeComplex0 = deltaComplex1 - deltaComplex3 
			gen changeComplex1 = deltaComplex1 - deltaComplex2 
		



			
			// Explanation: 
			// 	The variable stage23match is 1 if the observation is from stage 2, 
			// 	2 if it is for stage3-Discussed, and 3 if it is for stage3-Not Discussed
			//	impAlt is the same thing, but taking preferences in the simple frame as 
			//	welfare-relevant benchmark
			
		
		}
		

		
		// Mentioned in main text:
		// level of financial competence
		su absDiffDelta1
		reg absDiffDelta1, cl(id)
		

		drop absDiffDelta1
		rename absDiffDelta2 absDiffDelta0
		rename absDiffDelta3 absDiffDelta1
		
		drop mimicryAbsDiffDelta1 mimicryAbsDiffDeltaBench1
		rename mimicryAbsDiffDelta2 mimicryAbsDiffDelta0
		rename mimicryAbsDiffDelta3 mimicryAbsDiffDelta1
		rename mimicryAbsDiffDeltaBench2 mimicryAbsDiffDeltaBench0
		rename mimicryAbsDiffDeltaBench3 mimicryAbsDiffDeltaBench1
					
		reshape long improvement impAlt improvementM impAltM absDiffDelta mimicryAbsDiffDelta mimicryAbsDiffDeltaBench changeSimple changeComplex, i(id stage23match) j(discussed)
		
		gen stage23discussed = 10 * discussed + stage23

		label var part1sophisti "FinComp Part 1"
		label var part2FVsophistic "FinComp Part 2FV"
		

	
	capture: gen com = comMain == 1 | comEduc == 1
	
	capture: gen com_part12sophM1 = com * part12sophM1
	capture: gen com_part12sophM2 = com * part12sophM2
	
	capture: gen com_part12sophQ1 = com * part12sophQ1
	capture: gen com_part12sophQ2 = com * part12sophQ2
	capture: gen com_part12sophQ3 = com * part12sophQ3
	capture: gen com_part12sophQ4 = com * part12sophQ4

	capture: gen sdSimple2 = sdSimple^2
				
	
	su part1sophRPartner, d
	gen part1sophRpartnerM1 = part1sophRPartner < r(p50)
	gen part1sophRpartnerM2 = part1sophRPartner >= r(p50) 
	// M1 are those who make good decisions, M2 those who make bad decisions
	
	
	su part122sophRPartner, d
	gen part122sophRpartnerM1 = part122sophRPartner < r(p50)
	gen part122sophRpartnerM2 = part122sophRPartner >= r(p50) 

	
	gen interactionM00 = part12sophM1 == 0	& part122sophRpartnerM1 == 0
	gen interactionM01 = part12sophM1 == 0	& part122sophRpartnerM1 == 1
	gen interactionM10 = part12sophM1 == 1	& part122sophRpartnerM1 == 0
	gen interactionM11 = part12sophM1 == 1	& part122sophRpartnerM1 == 1
					
	// replace part1sophRpartnerM1 = 0 if com == 0
	// replace part1sophRpartnerM2 = 0 if com == 0
	
	// replace part1sophRpartnerM1 = 0 if com == 0
	// replace part1sophRpartnerM2 = 0 if com == 0
	replace interactionM00 = 0 if com == 0
	replace interactionM01 = 0 if com == 0						
	replace interactionM10 = 0 if com == 0
	replace interactionM11 = 0 if com == 0		
	

	**********************************************************
	
	// What drives the effects, changes in simply or in complexly framed valuations? 
	local controlsHereSparse = " part12sophisti  "

	xi: reg changeSimple com_part12sophM*  part12sophM1 	i.stage23discussed	`controlsHereSparse' if discussed == 0 ,cl(id) 
	xi: reg changeComplex com_part12sophM*  part12sophM1 	i.stage23discussed	`controlsHereSparse' if discussed == 0 ,cl(id) 
	
	xi: reg changeSimple interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
	xi: reg changeComplex interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
	
	capture gen absChangeSimple = abs(changeSimple)
	capture gen absChangeComplex = abs(changeComplex)
	
	xi: reg absChangeSimple interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
	xi: reg absChangeComplex interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
	
	**********************************************************

	// Do better and worse subjects differ systematically w.r.t. time preferences?
	
	xi: reg deltaSimple1 interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
	test interactionM10 == interactionM11
	xi: reg deltaSimple1 com_part12sophM*  part12sophM1 	i.stage23discussed	`controlsHereSparse' if discussed == 0 ,cl(id) 


	**********************************************************
	
	
	
	gen discussionMinutes = discussionTime / 60
	
	local controlsHereSparse = "  part12sophisti "
	
	rename improvement imp
	
	gen com_part1sophRpartnerM1 = com * part1sophRpartnerM1
	gen com_part1sophRpartnerM2 = com * part1sophRpartnerM2
	
	xi: reg imp interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' ,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse' 
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefitsNoControls.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex replace	
	
	xi: reg imp interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse' if discussed==0
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefitsNoControls.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Discussed", "No", "Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex 

	xi: reg imp interactionM* 	part12sophM1	i.stage23discussed  `controlsHereSparse' if discussed == 1, cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse' if discussed==1
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefitsNoControls.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Discussed", "Yes", "Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex
		
		
		xi: reg improvementM interactionM* part12sophM1 i.stage23discusse `controlsHereSparse' if discussed==1,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse improvementM com_part12sophM1 com_part12sophM2  part12sophM1 interactionM*  i.stage23discusse `controlsHereSparse' if discussed==1
			predict confidence,
			predict confidenceSD, stdp
			su confidence
			local confidence = round(r(mean),0.001)
			su confidenceSD
			local confidenceSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefitsNoControls.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Discussed", "Yes", "Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex
		

		xi: reg impAlt interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse'  ,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse' 
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefitsNoControls.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex

	xi: reg impAlt interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse'  if discussed==0
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefitsNoControls.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Discussed", "No", "Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex
			
		

	xi: reg impAlt interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==1 ,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse'  if discussed==1
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefitsNoControls.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Discussed", "Yes", "Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex(frag)
		
		xi: reg impAltM interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==1 ,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse'  if discussed==1
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefitsNoControls.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Discussed", "Yes", "Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex(frag)
		
		
	
	
	
								
}
	
********* Table B.5: Replication of Table 5, with all controls		 ******************
if 1 {

	clear
	use "data/mainDataCleaned.dta"
	
	
		sort pairId decisionNumber
		by pairId decisionNumber: egen maxComplex = max(deltaComplex) if pairId!=.
		by pairId decisionNumber: egen minComplex = min(deltaComplex) if pairId!=.	
		gen partnerDeltaComplex=.
		replace partnerDeltaComplex=maxComplex if deltaComplex==minComplex
		replace partnerDeltaComplex=minComplex if deltaComplex==maxComplex
	

		keep if receiver == 1
		keep if mplCheck == 1
		
		gen mimicryAbsDiffDelta=.
		replace mimicryAbsDiffDelta=absDiffDelta if part==1 | part==2
		replace mimicryAbsDiffDelta=absDiffDelta if part==3 & noComMain==1
		replace mimicryAbsDiffDelta=abs(partnerDeltaComplex-deltaSimple) if part==3 & ( comMain==1 | comEduc==1)
	
		gen mimicryAbsDiffDeltaBench=.
		replace mimicryAbsDiffDeltaBench=absD_0benchmark if part==1 | part==2
		replace mimicryAbsDiffDeltaBench=absD_0benchmark if part==3 & noComMain==1
		replace mimicryAbsDiffDeltaBench=MabsD_0benchmark if part==3 & ( comMain==1 | comEduc==1)
	
	
	
	
		drop partnerDeltaComplex maxComplex minComplex

		

		quietly {
			keep if stage23match ~= .
					
			capture: gen logHHinc = log(hhinc)
			capture: gen ageSq = age^2
			
			local keep_demoFirst = "male age ageSq ethnici nativel"
			local keep_demoSecond = "international  community"	// community is urban, suburban or rural
			local keep_cog = "cogAbility* mplCheck"	// variable knowledgeable is a coarsening of a continuous variable, and hence a suboptimal predictor
			local keep_financials = "logHHincPerCap cardown finLit part1sophistication part2FVsophistic part2sophistication finassistance cashadv cardroll"
			local keep_debrief = "heardBefore talk prepared followup"
			local keep_psych = "conformity bigFive_*" 
			local treatmentVars = "comEduc comMain noComMain noComNoAnn stage23match decisionKind"

			keep 	absDiffDelta absD_0bench  mimicryAbsDiffDelta mimicryAbsDiffDeltaBench main id comMain comEduc sdSimple  ///
					`keep_demoFirst' `keep_demoSecond' `keep_cog' `keep_financials' `keep_debrief' `keep_psych' `treatmentVars' ///
					international gpa com_part1soph* part1soph* part12soph* part122soph* *Partner partner* knowledgeable ///
					discussionTime finLitSum* gender partnerGender part1soph* deltaSimple deltaComplex
			
			order abs*
			
			reshape wide absDiffDelta absD_0benchmark mimicryAbsDiffDelta mimicryAbsDiffDeltaBench deltaSimple deltaComplex, i(id stage23match) j(decisionKind)
		
			gen improvement0 = absDiffDelta1 - absDiffDelta3 
			gen improvement1 = absDiffDelta1 - absDiffDelta2 

			gen impAlt0 = absD_0benchmark1 - absD_0benchmark3
			gen impAlt1 = absD_0benchmark1 - absD_0benchmark2
			
			gen improvementM0 = mimicryAbsDiffDelta1 - mimicryAbsDiffDelta3 
			gen improvementM1 = mimicryAbsDiffDelta1 - mimicryAbsDiffDelta2 

			gen impAltM0 = mimicryAbsDiffDeltaBench1 - mimicryAbsDiffDeltaBench3
			gen impAltM1 = mimicryAbsDiffDeltaBench1 - mimicryAbsDiffDeltaBench2
			
			gen changeSimple0 = deltaSimple1 - deltaSimple3 
			gen changeSimple1 = deltaSimple1 - deltaSimple2 

			gen changeComplex0 = deltaComplex1 - deltaComplex3 
			gen changeComplex1 = deltaComplex1 - deltaComplex2 
		



			
			// Explanation: 
			// 	The variable stage23match is 1 if the observation is from stage 2, 
			// 	2 if it is for stage3-Discussed, and 3 if it is for stage3-Not Discussed
			//	impAlt is the same thing, but taking preferences in the simple frame as 
			//	welfare-relevant benchmark
			
		
		}
		

		
		// Mentioned in main text:
		// level of financial competence
		su absDiffDelta1
		reg absDiffDelta1, cl(id)
		

		drop absDiffDelta1
		rename absDiffDelta2 absDiffDelta0
		rename absDiffDelta3 absDiffDelta1
		
		drop mimicryAbsDiffDelta1 mimicryAbsDiffDeltaBench1
		rename mimicryAbsDiffDelta2 mimicryAbsDiffDelta0
		rename mimicryAbsDiffDelta3 mimicryAbsDiffDelta1
		rename mimicryAbsDiffDeltaBench2 mimicryAbsDiffDeltaBench0
		rename mimicryAbsDiffDeltaBench3 mimicryAbsDiffDeltaBench1
					
		reshape long improvement impAlt improvementM impAltM absDiffDelta mimicryAbsDiffDelta mimicryAbsDiffDeltaBench changeSimple changeComplex, i(id stage23match) j(discussed)
		
		gen stage23discussed = 10 * discussed + stage23

		label var part1sophisti "FinComp Part 1"
		label var part2FVsophistic "FinComp Part 2FV"
		

	
	capture: gen com = comMain == 1 | comEduc == 1
	
	capture: gen com_part12sophM1 = com * part12sophM1
	capture: gen com_part12sophM2 = com * part12sophM2
	
	capture: gen com_part12sophQ1 = com * part12sophQ1
	capture: gen com_part12sophQ2 = com * part12sophQ2
	capture: gen com_part12sophQ3 = com * part12sophQ3
	capture: gen com_part12sophQ4 = com * part12sophQ4

	capture: gen sdSimple2 = sdSimple^2
				
	
	su part1sophRPartner, d
	gen part1sophRpartnerM1 = part1sophRPartner < r(p50)
	gen part1sophRpartnerM2 = part1sophRPartner >= r(p50) 
	// M1 are those who make good decisions, M2 those who make bad decisions
	
	
	su part122sophRPartner, d
	gen part122sophRpartnerM1 = part122sophRPartner < r(p50)
	gen part122sophRpartnerM2 = part122sophRPartner >= r(p50) 

	
	gen interactionM00 = part12sophM1 == 0	& part122sophRpartnerM1 == 0
	gen interactionM01 = part12sophM1 == 0	& part122sophRpartnerM1 == 1
	gen interactionM10 = part12sophM1 == 1	& part122sophRpartnerM1 == 0
	gen interactionM11 = part12sophM1 == 1	& part122sophRpartnerM1 == 1
					
	// replace part1sophRpartnerM1 = 0 if com == 0
	// replace part1sophRpartnerM2 = 0 if com == 0
	
	// replace part1sophRpartnerM1 = 0 if com == 0
	// replace part1sophRpartnerM2 = 0 if com == 0
	replace interactionM00 = 0 if com == 0
	replace interactionM01 = 0 if com == 0						
	replace interactionM10 = 0 if com == 0
	replace interactionM11 = 0 if com == 0		
	

	**********************************************************
	
	// What drives the effects, changes in simply or in complexly framed valuations? 
	local controlsHereSparse =" `demo' part12sophisti `survey' `psychCog' "

	xi: reg changeSimple com_part12sophM*  part12sophM1 	i.stage23discussed	`controlsHereSparse' if discussed == 0 ,cl(id) 
	xi: reg changeComplex com_part12sophM*  part12sophM1 	i.stage23discussed	`controlsHereSparse' if discussed == 0 ,cl(id) 
	
	xi: reg changeSimple interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
	xi: reg changeComplex interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
	
	capture gen absChangeSimple = abs(changeSimple)
	capture gen absChangeComplex = abs(changeComplex)
	
	xi: reg absChangeSimple interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
	xi: reg absChangeComplex interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
	
	**********************************************************

	// Do better and worse subjects differ systematically w.r.t. time preferences?
	
	xi: reg deltaSimple1 interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
	test interactionM10 == interactionM11
	xi: reg deltaSimple1 com_part12sophM*  part12sophM1 	i.stage23discussed	`controlsHereSparse' if discussed == 0 ,cl(id) 


	**********************************************************
	
	
	
	gen discussionMinutes = discussionTime / 60
	
	local controlsHereSparse = " `demo' part12sophisti `survey' `psychCog' "
	
	rename improvement imp
	
	gen com_part1sophRpartnerM1 = com * part1sophRpartnerM1
	gen com_part1sophRpartnerM2 = com * part1sophRpartnerM2
	
	xi: reg imp interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' ,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse' 
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefitsControls.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex replace	
	
	xi: reg imp interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse' if discussed==0
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefitsControls.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Discussed", "No", "Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex 

	xi: reg imp interactionM* 	part12sophM1	i.stage23discussed  `controlsHereSparse' if discussed == 1, cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse' if discussed==1
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefitsControls.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Discussed", "Yes", "Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex
		
		
		xi: reg improvementM interactionM* part12sophM1 i.stage23discusse `controlsHereSparse' if discussed==1,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse improvementM com_part12sophM1 com_part12sophM2  part12sophM1 interactionM*  i.stage23discusse `controlsHereSparse' if discussed==1
			predict confidence,
			predict confidenceSD, stdp
			su confidence
			local confidence = round(r(mean),0.001)
			su confidenceSD
			local confidenceSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefitsControls.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Discussed", "Yes", "Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex
		

		xi: reg impAlt interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' ,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse' 
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefitsControls.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex

	xi: reg impAlt interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==0 ,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse'  if discussed==0
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefitsControls.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Discussed", "No", "Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex
			
		

	xi: reg impAlt interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==1 ,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse'  if discussed==1
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefitsControls.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Discussed", "Yes", "Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex(frag)
		
		xi: reg impAltM interactionM* 	part12sophM1 i.stage23discussed	 `controlsHereSparse' if discussed==1 ,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* i.stage23discussed	`controlsHereSparse'  if discussed==1
			predict contrImprovement,
			predict contrImprovementSD, stdp
			su contrImprovement
			local contrImprovement = round(r(mean),0.001)
			su contrImprovementSD
			local contrImprovementSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/whoBenefitsControls.tex",  keep(interactionM* part12sophM1 part12sophR) label dec(3)  ///
			addtext("Discussed", "Yes", "Sample", "all", "Controls", "Yes") ///
			addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `contrImprovement', "SD level control", `contrImprovementSD') ///
			tex(frag)
		
		
	
		
	
	
								
}
	
********* TABLE B.7: Effects of Treatments on Confidence  by Subjects preknowledge ***************************
if 1 {

	clear
	use "data/mainDataCleaned.dta"

	keep if receiver == 1
	keep if mplCheck == 1
	keep if tagID==1
	

	quietly {
		keep if stage23match ~= .
				
		capture: gen logHHinc = log(hhinc)
		capture: gen ageSq = age^2
		
		local keep_demoFirst = "male age ageSq ethnici nativel"
		local keep_demoSecond = "international  community"	// community is urban, suburban or rural
		local keep_cog = "cogAbility* mplCheck"	// variable knowledgeable is a coarsening of a continuous variable, and hence a suboptimal predictor
		local keep_financials = "logHHincPerCap cardown finLit part1sophistication part2FVsophistic part2sophistication finassistance cashadv cardroll"
		local keep_debrief = "heardBefore talk prepared followup"
		local keep_psych = "conformity bigFive_*" 
		local treatmentVars = "comEduc comMain noComMain noComNoAnn stage23match decisionKind"

		local controlsHereSparse = " `demo' part12sophisti  "
		}

		
		
		
		
		
		
		
		
	su part122sophRPartner, d
	gen part122sophRpartnerM1 = part122sophRPartner < r(p50)
	gen part122sophRpartnerM2 = part122sophRPartner >= r(p50) 
	
	gen interactionM00 = part12sophM1 == 0	& part122sophRpartnerM1 == 0
	gen interactionM01 = part12sophM1 == 0	& part122sophRpartnerM1 == 1
	gen interactionM10 = part12sophM1 == 1	& part122sophRpartnerM1 == 0
	gen interactionM11 = part12sophM1 == 1	& part122sophRpartnerM1 == 1
					

	replace interactionM00 = 0 if com == 0
	replace interactionM01 = 0 if com == 0						
	replace interactionM10 = 0 if com == 0
	replace interactionM11 = 0 if com == 0	

	gen com_part12sophM1 =com*part12sophM1
	gen com_part12sophM2 =com*part12sophM2
	
	
xi: reg compselg_1 interactionM* part12sophM1 part12sophisti  ,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse compselg_1 com_part12sophM1 com_part12sophM2 part12sophM1 interactionM* part12sophisti
			predict confidence,
			predict confidenceSD, stdp
			su confidence
			local confidence = round(r(mean),0.001)
			su confidenceSD
			local confidenceSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/confidenceWho.tex",  keep(interactionM* part12sophM1)  label dec(3)addtext("Sample", "main", "Demogr.", "-", "Survey", "-", "Psychological", "-") addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `confidence', "SD level control", `confidenceSD') tex replace
	
	
	xi: reg compselg_1 interactionM* part12sophM1 part12sophisti `demo' ,  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace com_part12sophM1 = 0
			replace com_part12sophM2 = 0
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse compselg_1 com_part12sophM1 com_part12sophM2  part12sophM1 interactionM* part12sophisti `demo' 
			predict confidence,
			predict confidenceSD, stdp
			su confidence
			local confidence = round(r(mean),0.001)
			su confidenceSD
			local confidenceSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/confidenceWho.tex",  keep(interactionM* part12sophM1)  label dec(3)addtext("Sample", "main", "Demogr.", "Yes", "Survey", "-", "Psychological", "-") addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `confidence', "SD level control", `confidenceSD') tex(frag)
		
		xi: reg compselg_1 interactionM* part12sophM1 part12sophisti `demo' `survey' `psychCog',  cl(id) 
		local numSubj = e(N_clust)
		test interactionM00 = interactionM01 
		local p12 = round(r(p), 0.001)
		test interactionM00 = interactionM10
		local p13 = round(r(p), 0.001)
		test interactionM00 = interactionM11 
		local p14 = round(r(p), 0.001)
		test interactionM01 = interactionM10 
		local p23 = round(r(p), 0.001)
		test interactionM01 = interactionM11 
		local p24 = round(r(p), 0.001)
		test interactionM10 = interactionM11 
		local p34 = round(r(p), 0.001)
		test interactionM00 = interactionM01 = interactionM10 = interactionM11 = 0
		local pJoint = r(p)
		preserve 
			replace interactionM00 = 0
			replace interactionM01 = 0
			replace interactionM10 = 0
			replace interactionM11 = 0
			xi: collapse compselg_1 com_part12sophM1 com_part12sophM2  part12sophM1 interactionM* part12sophisti `demo' `survey' `psychCog'
			predict confidence,
			predict confidenceSD, stdp
			su confidence
			local confidence = round(r(mean),0.001)
			su confidenceSD
			local confidenceSD = round(r(mean),0.001)
		restore		
		outreg2 using "tables/confidenceWho.tex",  keep(interactionM* part12sophM1)  label dec(3)addtext("Sample", "main", "Demogr.", "Yes", "Survey", "Yes", "Psychological", "Yes") addstat("P(00 = 01)", `p12', "P(00 = 10)", `p13', "P(00 = 11)", `p14', "P(01 = 10)", `p23', "P(01 = 11)", `p24', "P(10 = 11)", `p34', "P(joint)", `pJoint', "#subj", `numSubj', "Level in control", `confidence', "SD level control", `confidenceSD') tex(frag)
		

}

********* TABLE B.8: Competence and Perceived Competence ***************************
if 1 {
	clear
	use "data/mainDataCleaned.dta"
	keep if mplCheck == 1

	su ownTimePrefsMean1 if receiver==1 & part12sophM1 == 0 & tagID==1 & com==1
	su ownTimePrefsMean1 if receiver==1 & part12sophM1 == 1 & tagID==1 & com==1
	su ownTimePrefsMean1 if sender==1 & part12sophM1 == 0 & tagID==1 
	su ownTimePrefsMean1 if sender==1 & part12sophM1 == 1 & tagID==1 
		

		gen preferenceMatch1=.
		replace preferenceMatch1=abs(ownTimePrefsMean1-partnerTimePrefsMean1)
		

		keep if receiver==1	
		keep if com==1
	

	su part2sophistication if tagId==1 & com==1, de
	su part2sophisticationPartner if tagId==1, de

		

	replace part2sophistication=-part2sophistication
	replace part2sophisticationPartner=-part2sophisticationPartner
	gen interaction=part2sophistication*part2sophisticationPartner 

		su part2sophistication, d
		gen R_Bottom = part2sophistication < r(p50)
		gen R_Top = part2sophistication >= r(p50) 
		
		su part2sophisticationPartner, d
		gen S_Bottom = part2sophisticationPartner < r(p50)
		gen S_Top = part2sophisticationPartner >= r(p50) 
		
		gen R_Bottom_S_Top = R_Bottom == 1	& S_Top==1
		gen R_Top_S_Top =  R_Top ==1 & S_Top==1

	rename part2sophistication ownDeliberativeCompetence 
	rename part2sophisticationPartner partnerDeliberativeCompetence



	reg partnerGraspAbsolute  ownDeliberativeCompetence  partnerDeliberativeCompetence interaction if tagID==1 & partnerDeliberativeCompetence>-1.5, vce(robust) 

	reg partnerGraspAbsolute  ownDeliberativeCompetence  partnerDeliberativeCompetence interaction if tagID==1 & partnerDeliberativeCompetence>-1, vce(robust) 


	reg partnerGraspAbsolute  ownDeliberativeCompetence  partnerDeliberativeCompetence interaction if tagID==1 & partnerDeliberativeCompetence>-0.5, vce(robust) 

	reg partnerGraspAbsolute  R_Bottom_S_Top R_Top R_Top_S_Top if tagID==1 & partnerDeliberativeCompetence>-1.5, vce(robust) 

	reg partnerGraspAbsolute  R_Bottom_S_Top R_Top R_Top_S_Top if tagID==1 & partnerDeliberativeCompetence>-1, vce(robust) 

	reg partnerGraspAbsolute  R_Bottom_S_Top R_Top R_Top_S_Top if tagID==1 & partnerDeliberativeCompetence>-0.5, vce(robust) 


	reg partnerGraspAbsolute  ownDeliberativeCompetence  partnerDeliberativeCompetence interaction  if tagID==1, vce(robust) 
	reg partnerGraspAbsolute  ownDeliberativeCompetence  partnerDeliberativeCompetence interaction `demo' if tagID==1, vce(robust) 
	reg partnerGraspAbsolute  ownDeliberativeCompetence  partnerDeliberativeCompetence interaction `demo' `psychCog' `survey' if tagID==1, vce(robust) 


		

	eststo clear
	eststo: reg partnerGraspAbsolute  R_Bottom_S_Top R_Top R_Top_S_Top if tagID==1, vce(robust) 
			local numSubj = e(N)
			test R_Bottom_S_Top = R_Top_S_Top
			local p = round(r(p), 0.001)
			outreg2 using "tables/partnerGraspWho.tex", addstat("P(01 = 11)", `p', "#subj", `numSubj')  tex replace

	eststo: reg partnerGraspAbsolute  R_Bottom_S_Top R_Top R_Top_S_Top `demo' if tagID==1, vce(robust) 
			local numSubj = e(N)
			test R_Bottom_S_Top = R_Top_S_Top
			local p = round(r(p), 0.001)
			outreg2 using "tables/partnerGraspWho.tex",  addstat("P(01 = 11)", `p', "#subj", `numSubj') tex(frag)

			eststo: reg partnerGraspAbsolute  R_Bottom_S_Top R_Top R_Top_S_Top `demo' `psychCog' `survey' if tagID==1, vce(robust) 
			local numSubj = e(N)
			test R_Bottom_S_Top = R_Top_S_Top
			local p = round(r(p), 0.001)
	outreg2 using "tables/partnerGraspWho.tex", addstat("P(01 = 11)", `p', "#subj", `numSubj') tex(frag)


	su partnerGraspAbsolute  if R_Bottom==1 & S_Bottom==1 & tagId==1, de
	su partnerGraspAbsolute  if R_Bottom==1 & S_Top==1 & tagId==1, de
	su partnerGraspAbsolute  if R_Top==1 & S_Bottom==1  & tagId==1, de
	su partnerGraspAbsolute  if R_Top==1 & S_Top==1 & tagId==1, de
	//RbottomSbottom vs RbottomStop
	ttest partnerGraspAbsolute if tagId==1 & R_Bottom==1, by(S_Top) 
	//RtopStop vs RtopSbottom
	ttest partnerGraspAbsolute if tagId==1 & R_Top==1, by(S_Top) 
	//RbottomSbottom vs RtopSbottom
	ttest partnerGraspAbsolute if tagId==1 & S_Bottom==1, by(R_Top) 
	//RbottomStop vs RtopStop
	ttest partnerGraspAbsolute if tagId==1 & S_Top==1, by(R_Top) 


	rename  ownDeliberativeCompetence part2sophistication
	rename  partnerDeliberativeCompetence part2sophisticationPartner

}
